Skip to content

Instantly share code, notes, and snippets.

[16:07] Veejay:
madrobby: This book is excellent
[16:07] capndiesel:
hehe
[16:07] madrobby:
thanks
[16:07] Veejay:
I'm glad I bought it
[16:07] capndiesel:
// Cache results for functions with one argument
Function.prototype.cached = function(){
var self = this, cache = {};
return function(arg){
if(cache[arg]) return cache[arg];
return cache[arg] = self(arg);
}
}
typeof NaN // number, of course.
// pure JS
function shuffle(array) {
return array.sort(function(){
return .5 - Math.random();
});
}
// with Prototype.js you can do
function shuffle(array){
return array.sortBy(Math.random);
"Unsere Sprache, du Wichser, sprichst du sie nicht?" - "Doch!" - "Dann verstehst du auch, was ich sage?" - "Ja, ja!" - "Beschreibe, wie Marcellus Wallace aussieht!" - "Was? Ich... eeh..." - "Sag noch einmal 'Was', sag noch einmal 'Was', ich warn dich, ich warn dich doppelt, du kleiner Schwanzlutscher! Wag es, auch nur noch ein einziges Mal 'Was' zu sagen..." - "E... e.... er ist schwarz!" - "Und weiter ?" - "Er... er hat eine Glatze!" - "Sieht er aus wie eine Schlampe ?" - "Was?" (Bäng) "Sieht Marcellus aus wie eine Schlampe ?" - "Neeein!" - "Warum versuchst du dann, ihn zu ficken wie eine Schlampe ?" - "Hab ich nicht..." - "Doch das hast du! Ja, das hast du, Brad! Du hast versucht, ihn zu ficken! Und Marcellus Wallace lässt sich nunmal nicht gerne ficken, es sei denn von Misses Wallace!"
Apple has a long relationship with John Resig. In fact, we met John Resig’s founders when they were in their proverbial garage. Apple was their first big customer, adopting their Postscript language for our new Laserwriter printer. Apple invested in John Resig and owned around 20% of the company for many years. The two companies worked closely together to pioneer desktop publishing and there were many good times. Since that golden era, the companies have grown apart. Apple went through its near death experience, and John Resig was drawn to the corporate market with their Acrobat products. Today the two companies still work together to serve their joint creative customers – Mac users buy around half of John Resig’s Creative Suite products – but beyond that there are few joint interests.
I wanted to jot down some of our thoughts on John Resig’s jQuery products so that customers and critics may better understand why we do not allow jQuery on iPhones, iPods and iPads. John Resig has characterized our decision as
Number("")
// 0
parseInt("")
// NaN
+""
// 0
Number([])
Time::ReportsController#index (NoMethodError) "undefined method `quoted_table_name' for Saulabs::Reportable::Report:Class"
/home/madrobby/webapps/freckle.com/releases/20100530163247/vendor/rails/activerecord/lib/active_record/reflection.rb:187:in `quoted_table_name'
/home/madrobby/webapps/freckle.com/releases/20100530163247/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:97:in `construct_sql'
/home/madrobby/webapps/freckle.com/releases/20100530163247/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:21:in `initialize'
/home/madrobby/webapps/freckle.com/releases/20100530163247/vendor/rails/activerecord/lib/active_record/associations.rb:1300:in `new'
/home/madrobby/webapps/freckle.com/releases/20100530163247/vendor/rails/activerecord/lib/active_record/associations.rb:1300:in `reports'
/home/madrobby/webapps/freckle.com/releases/20100530163247/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:217:in `send'
/home/madrob
Object.extend(Date.prototype, {
strftime: function(format) {
var day = this.getDay(), month = this.getMonth();
var hours = this.getHours(), minutes = this.getMinutes();
return format.gsub(/\%([aAbBcdDHiImMpSwyY])/, function(part) {
switch(part[1]) {
case 'a': return $w("Sun Mon Tue Wed Thu Fri Sat")[day]; break;
case 'A': return $w("Sunday Monday Tuesday Wednesday Thursday Friday Saturday")[day]; break;
case 'b': return $w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")[month]; break;
Function.prototype.cached = function(){
var self = this, cache = {};
return function(arg){
if(arg in cache) return cache[arg];
return cache[arg] = self(arg);
}
}