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 characters
| Number.prototype.plus = function(value) { | |
| return this + value; | |
| } | |
| Number.prototype.minus = function(value) { | |
| return this - value; | |
| } | |
| var a = (5).plus(3).minus(6); // 2 |
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 characters
| function add(n1) { | |
| return function (n2) { | |
| return n1 + n2; | |
| } | |
| } | |
| console.log(add(2)(3)); // 5 |
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 characters
| multiplexCallback = (function () { | |
| var callbacks = {}; | |
| return function(callbackable, callback) { | |
| var callbackList = callbacks[callbackable] || []; | |
| callbackList.push(callback); | |
| if (!callbacks[callbackable]) { | |
| callbacks[callbackable] = callbackList; | |
| callbackable(function () { |
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 characters
| def queue_tip(*args) | |
| queue = ["A","B","C","D","E","F","G","H"] | |
| return queue if args.size == 0 | |
| raise "odd number of arguments" unless args.size.even? | |
| slots = {} | |
| letters = {} |
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 characters
| express = require 'express' | |
| stylus = require 'stylus' | |
| app = express.createServer() | |
| # stylus | |
| app.use stylus.middleware { | |
| debug: true, | |
| src: __dirname + '/public', | |
| dest: __dirname + '/public', |
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 characters
| /Users/mkuklis/.rvm/gems/ruby-1.9.2-p180@iYouVo/gems/carrierwave-0.5.4/lib/carrierwave/processing/rmagick.rb:248: [BUG] Segmentation fault | |
| ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0] | |
| -- control frame ---------- | |
| c:0112 p:---- s:0553 b:0553 l:000552 d:000552 CFUNC :read | |
| c:0111 p:0054 s:0549 b:0549 l:000548 d:000548 METHOD /Users/mkuklis/.rvm/gems/ruby-1.9.2-p180@iYouVo/gems/carrierwave-0.5.4/lib/carrierwave/processing/rmagick.rb:248 | |
| c:0110 p:0011 s:0540 b:0540 l:000539 d:000539 METHOD /Users/mkuklis/.rvm/gems/ruby-1.9.2-p180@iYouVo/gems/carrierwave-0.5.4/lib/carrierwave/processing/rmagick.rb:132 | |
| c:0109 p:0015 s:0535 b:0535 l:000525 d:000534 BLOCK /Users/mkuklis/.rvm/gems/ruby-1.9.2-p180@iYouVo/gems/carrierwave-0.5.4/lib/carrierwave/uploader/processing.rb:77 | |
| c:0108 p:---- s:0531 b:0531 l:000530 d:000530 FINISH | |
| c:0107 p:---- s:0529 b:0529 l:000528 d:000528 CFUNC :each |
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 characters
| // https://gist.github.com/854622 | |
| (function(window,undefined){ | |
| // Prepare our Variables | |
| var | |
| History = window.History, | |
| $ = window.jQuery, | |
| document = window.document; | |
| // Check to see if History.js is enabled for our Browser |
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 characters
| function inherit(C, P) { | |
| var F = function () {}; | |
| F.prototype = P.prototype; | |
| C.prototype = new F(); | |
| C._super = P.prototype; | |
| C.prototype.constructor = C; | |
| } |
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 characters
| var doThisDoThat = function () { | |
| console.log("do this"); | |
| doThisDoThat = function () { | |
| console.log("do that"); | |
| }; | |
| }; | |
| doThisDoThat() // do this | |
| doThisDoThat() // do that |
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 characters
| if (typeof Array.isArray === "undefined") { | |
| Array.isArray = function (arg) { | |
| return Object.prototype.toString.call(arg) === "[object Array]"; | |
| }; | |
| } |