Thursday, 30 August 2012

ajaxQueue

/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function($) {
// jQuery on an empty object, we are going to use this as our Queue
var ajaxQueue = $({});
$.ajaxQueue = function( ajaxOpts ) {
var jqXHR,
dfd = $.Deferred(),
promise = dfd.promise();
// queue our ajax request
ajaxQueue.queue( doRequest );
// add the abort method
promise.abort = function( statusText ) {
// proxy abort to the jqXHR if it is active
if ( jqXHR ) {
return jqXHR.abort( statusText );
}
// if there wasn't already a jqXHR we need to remove from queue
var queue = ajaxQueue.queue(),
index = $.inArray( doRequest, queue );
if ( index > -1 ) {
queue.splice( index, 1 );
}
// and then reject the deferred
dfd.rejectWith( ajaxOpts.context || ajaxOpts, [ promise, statusText, "" ] );
return promise;
};
// run the actual query
function doRequest( next ) {
jqXHR = $.ajax( ajaxOpts )
.done( dfd.resolve )
.fail( dfd.reject )
.then( next, next );
}
return promise;
};
})(jQuery);
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)

Javascript Hot Keys

jQuery.hotkeys = {
version: "0.8",
specialKeys: {
8: "backspace",
9: "tab",
13: "return",
16: "shift",
17: "ctrl",
18: "alt",
19: "pause",
20: "capslock",
27: "esc",
32: "space",
33: "pageup",
34: "pagedown",
35: "end",
36: "home",
37: "left",
38: "up",
39: "right",
40: "down",
45: "insert",
46: "del",
96: "0",
97: "1",
98: "2",
99: "3",
100: "4",
101: "5",
102: "6",
103: "7",
104: "8",
105: "9",
106: "*",
107: "+",
109: "-",
110: ".",
111: "/",
112: "f1",
113: "f2",
114: "f3",
115: "f4",
116: "f5",
117: "f6",
118: "f7",
119: "f8",
120: "f9",
121: "f10",
122: "f11",
123: "f12",
144: "numlock",
145: "scroll",
191: "/",
224: "meta"
},
shiftNums: {
"`": "~",
"1": "!",
"2": "@",
"3": "#",
"4": "$",
"5": "%",
"6": "^",
"7": "&",
"8": "*",
"9": "(",
"0": ")",
"-": "_",
"=": "+",
";": ": ",
"'": "\"",
",": "<",
".": ">",
"/": "?",
"\\": "|"
}
};
view raw gistfile1.js hosted with ❤ by GitHub

Friday, 24 August 2012

sam-stephenson-of-37signals

http://alittlecode.com/coffeescript-intro-video-by-sam-stephenson-of-37signals/

Tuesday, 14 August 2012

FAST KEY REPEAT RATE vic nava

FAST KEY REPEAT RATE the fastest rate by system preference is 2 need too logout/login to see the effect defaults write NSGlobalDomain KeyRepeat -int 0

Saturday, 11 August 2012

rais in production compile assets

in : config/environments/production.rb config.assets.compile = true Then run: rake assets:precompile --trace RAILS_ENV=production Then: rails s -e production

Thursday, 9 August 2012

:send

(1..3).each do |index|
b = Bucket.find(index)
b.is_linear.should_not == send(:"bucket_#{index}_before").is_linear
# b.is_default_active.should_not == bucket_1_before.is_default_active
# b.is_default_active.should_not == bucket_1_before.is_default_active
end
view raw gistfile1.rb hosted with ❤ by GitHub

Wednesday, 8 August 2012

Thursday, 2 August 2012

Spork and Rpsec and Bash


in .profile
Start Spork if is not runing and pass params the file


function rtest{
if pgrep -f spork; then echo running; else spork &; fi
rspec --drb --color --format doc "$@"
}


rtest spec/requests/whatever