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 :)
1 2 3 4
/** * http://www.openjs.com/scripts/events/keyboard_shortcuts/ * Version : 2.01.B ...
JavaScript Handling Keyboard Shortcuts...
by Tien Dung,
July 29, 2008 09:30,
1 refactoring
I found below code very use...
1 2 3 4
module ThinkingSphinx class Search class << self ...
Ruby How to extend a class prope...
Recently, I need to extend ...
JavaScript On countdown timer (minutes &a...
by Tien Dung,
July 28, 2008 23:43
Hi Steve, just change to fu...
1 2 3 4
def tab(name, options = {}) match = [ controller.controller_name, root_of_path ].map(&:humanize).include?( name ) content_tag( :li, link_to("<span>#{name}</span>", options), match ? { :class => "active" } : nil ) ...
1 2 3 4
var odump = (function(){ var max, INDENT = " "; // As long as you need :) ...
JavaScript On Recursively dump an object
by Tien Dung,
July 25, 2008 10:00
More JavaScript magic and e...

