This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zero:Scratch brian$ ruby --version # Should be similar on all versions of MRI | |
ruby 1.9.3dev (2010-06-30 trunk 28489) [x86_64-darwin10.4.0] | |
zero:Scratch brian$ ruby secure_cmp.rb | |
Rehearsal ------------------------------------------ | |
binary 4.020000 0.000000 4.020000 ( 4.012945) | |
hash 2.180000 0.000000 2.180000 ( 2.187391) | |
--------------------------------- total: 6.200000sec | |
user system total real | |
binary 4.010000 0.010000 4.020000 ( 4.003827) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vows = require('vows'); | |
vows.describe('Deep Thought', { | |
topic: function () { | |
this.thought = new DeepThought; // prototypical scopes | |
}, | |
'thought is logical': [ | |
'define axioms' : { | |
topic: function () {...}, | |
'assert something': function () {...} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'), | |
url = require('url'), | |
mylog="log:\r\n"; | |
function log(str) { | |
mylog += str + "\r\n"; | |
} | |
var server = http.createServer(function (request, response) { | |
switch (url.parse(request.url).pathname) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def transaction | |
# pre transaction | |
REDIS.MULTI | |
# transaction | |
rescue | |
REDIS.DISCARD | |
# transaction failure | |
raise | |
else | |
REDIS.EXEC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NoMethodError: undefined method `extend_object' on nil:NilClass. | |
kernel/delta/kernel.rb:85:in `extend_object (method_missing)' | |
kernel/common/kernel.rb:413:in `extend' | |
kernel/common/array.rb:1370:in `reverse_each' | |
kernel/common/kernel.rb:412:in `extend' | |
# extend is being called on a proc with a simple module. Rails reloading causing this? Rubinius quirk? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rbx-head :001 > class MyProc < Proc; end | |
=> nil | |
rbx-head :002 > MyProc.new {}.class | |
=> Proc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExtraProc < Proc | |
attr_reader :extra | |
def initialize(extra, &b) | |
@extra = extra | |
super(&b) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin some_sprite($state) { | |
background-image: url(...); | |
/* etc... */ | |
} | |
@mixin some_sprite(default) { | |
background-position: 0px 18px; | |
} | |
@mixin some_sprite(hover) { | |
background-position: 18px 18px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin some_sprite($state) { | |
background-image: url(...); | |
background-position: if($state is hover, 18px, 0px) 18px; | |
} | |
// somewhere down the line .......... | |
.thingy { | |
@include some_sprite(default); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var Foo, a; | |
var __slice = Array.prototype.slice; | |
Foo = (function() { | |
function Foo() {} | |
return Foo; | |
})(); | |
a = [1, 2, 4]; | |
(function(func, args, ctor) { | |
ctor.prototype = func.prototype; |
OlderNewer