1 2 3 4
jQuery.fn.checkNext = function() { if (this.is(':selected')) { this.attr('selected', false); ...
JavaScript On Check next option in select...
by Tien Dung,
January 26, 2009 01:22
Simo refactoring is great. ...
C On How to find max, min of thr...
by Tien Dung,
November 20, 2008 00:01
Hi Eineki, please explain h...
1 2 3 4
int max = rand(); // or any init value int min = rand(); // or any init value int tmp = rand(); // or any init value ...
C How to find max, min of thr...
by Tien Dung,
November 18, 2008 12:33,
15 refactorings
I tried to use as less vari...
1 2 3 4
function getAnchor(default) { default = default || 'news'; return document.location.toString().split( '#' )[1] || default; ...
JavaScript On Small Javascript Code
by Tien Dung,
October 06, 2008 22:23
You can't do ||= in JavaScript
1 2 3 4
Q("#toggler").click(function() { var mode = this.mode; this.mode = !mode; ...
JavaScript On Toggle "Check all / Un...
by Tien Dung,
October 06, 2008 22:19
Use true/false instead of u...
1 2 3 4
// Don't know why you need hash > 0 and page.length > 1 // In case you don't need those conditions var page = document.location.toString().split("#")[1]; ...
1 2 3 4
def square(number) return number**2 end ...
Ruby On Conditional Assignment
by Tien Dung,
September 22, 2008 01:27
temp variable based version...
Ruby On Conditional Assignment
by Tien Dung,
September 22, 2008 00:01
Hi Daniel, can you ask Marc...
Ruby On Conditional Assignment
by Tien Dung,
September 21, 2008 22:31
Thanks Daniel. I found the ...
Ruby On Conditional Assignment
by Tien Dung,
September 21, 2008 16:19
Don't know who vote 1 star ...
1 2 3 4
def square(number) return number**2 end ...
Ruby On Conditional Assignment
by Tien Dung,
September 21, 2008 15:58
Refactor Amos King .max fun...
1 2 3 4
def square(number) return number**2 end ...
Ruby On Conditional Assignment
by Tien Dung,
September 21, 2008 15:43
I prefer using temp variabl...
1 2 3 4
class Listing < ActiveRecord::Base require_dependency "listing/property_related" require_dependency "listing/price_related" ...
Ruby require_dependency
by Tien Dung,
September 18, 2008 01:08,
3 refactorings
Rails require_dependency usage
1 2 3 4
function state_classes(updateall) { var value = display.value * 1, tempcolor; var element, state, ...
JavaScript On Color elements by state of ...
by Tien Dung,
September 16, 2008 06:44
or using eval(..)
1 2 3 4
function state_classes(updateall) { var value = display.value * 1, tempcolor; var element, state, states = ["Unknown", "Gas", "Liquid", "Solid"]; ...
1 2 3 4
function saveAndSet(obj, newValues) { var oldValues = {}; for (var p in newValues) ...
JavaScript On Setting focus after alert
by Tien Dung,
August 19, 2008 00:41
Hi Daniel,
I create a sav...
1 2 3 4
class UsersController < ApplicationController def index @users = find_all_and_order_by(params[:order_by]) ...
Ruby On showing records in Ascendin...
by Tien Dung,
August 06, 2008 14:07
Hi DG,
1) We should not pu...
1 2 3 4
/** * http://www.openjs.com/scripts/events/keyboard_shortcuts/ * Version : 2.01.B ...
JavaScript On Handling Keyboard Shortcuts...
by Tien Dung,
August 06, 2008 07:22
My final attempt :)
