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
| xclip -sel clip < $1 |
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 generateEdges(graph) { | |
| var i, node, edges = []; | |
| for (node in graph) { | |
| graph[node].forEach(function (neighbour) { | |
| edges.push([node, neighbour]); | |
| }); | |
| } | |
| return edges; |
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 Binder = exports.Binder = function () { | |
| this._funcs = []; | |
| }; | |
| Binder.prototype.bind = function (func) { | |
| var args = Array.prototype.slice.call(arguments, 1), | |
| trg = this._trigger; | |
| this._funcs.unshift(function (next) { | |
| func.apply(func.prototype.constructor, args.concat([next])); |
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
| exports.usingNamespace = function (global) { | |
| var objs = Array.prototype.slice.call(arguments, 1); | |
| objs.forEach(function (obj) { | |
| var prop; | |
| for (prop in obj) | |
| global[prop] = obj[prop]; | |
| }); | |
| }; |
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 escape(str) { | |
| return str.replace(/[<>"\'=]/g, function (chr) { | |
| return { | |
| '<': '<', | |
| '>': '>', | |
| '"': '"', | |
| "'": ''', | |
| '=': '=' | |
| }[chr]; | |
| }); |
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 binder = function () { | |
| function func(next) { | |
| next.apply(this, Array.prototype.slice.call(arguments, 1)); | |
| }; | |
| func.bind = function (f) { | |
| return Function.prototype.bind.call(this, null, f); | |
| }; | |
| return func; |
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 integrateRegExp( regExps, flag ){ | |
| var source = ''; | |
| for( var regExp, i = 0; regExp = regExps[ i++ ]; ){ | |
| source += regExp.source; | |
| } | |
| return new RegExp( source, flag ); | |
| } |
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 gcd ( m, n ){ | |
| var remainder; | |
| return m < n ? gcd( n, m ) : ( remainder = m % n ) === 0 ? n : gcd( n, remainder ); | |
| } | |
| gcd( 8942555, 144400 ); // 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
| var mongoose = require( 'mongoose' ); | |
| var db = mongoose.createConnection( 'mongoose://localhost/test' ); | |
| db.on( 'error', function( err ){ | |
| console.log( err ); | |
| }); | |
| db.once( 'open', function(){ | |
| var Schema = mongoose.Schema; |
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
| ### | |
| CoffeeScript Tests for ME! | |
| I found CoffeeScript is very very simple... | |
| @author Saneyuki Tadokoro (@Saneyan or @jSaneyan) <post@saneyuki.gfunction.com> | |
| ### | |
| # | |
| # Util |