Created
August 28, 2008 14:05
-
-
Save beastaugh/7727 to your computer and use it in GitHub Desktop.
Revisions
-
beastaugh revised this gist
Aug 28, 2008 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,9 @@ * Copied from Mikael Brockman's code in Ruby on Rails' ActiveSupport library. * http://weblog.jamisbuck.org/2006/10/27/mining-activesupport-object-returning */ function returning(value, block, context) { block.call(context || null, value); return value; }; (function test_returning() { @@ -19,4 +19,3 @@ function returning(object, block) { print(test.cool); print(test.wow); })(); -
beastaugh created this gist
Aug 28, 2008 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ /** * An implementation of the K Combinator. * http://wiki.tcl.tk/1923 * * Copied from Mikael Brockman's code in Ruby on Rails' ActiveSupport library. * http://weblog.jamisbuck.org/2006/10/27/mining-activesupport-object-returning */ function returning(object, block) { block(object); return object; }; (function test_returning() { var test = returning({}, function(obj) { obj.cool = "Brilliant!"; obj.wow = "Amazing!" }); print(test.cool); print(test.wow); })();