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
// lo-dash lib is the dependency | |
function readOnly(target){ | |
var _readOnly = function (target, acc) { | |
// acc is passed into the function to be used for observer | |
var _defineProperty = function (propName, target, acc) { | |
var i, len; | |
// operation to be performed when add occurred |
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 B = require("bluebird/js/main/promise")(); | |
var Bproto = B.prototype; | |
var deferredPrototype = B.pending().constructor.prototype; | |
deferredPrototype.makeNodeResolver = function() { | |
return this.asCallback; | |
}; | |
function bind(fn, ctx) { |
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
/* | |
* object.watch polyfill | |
* | |
* 2012-04-03 | |
* | |
* By Eli Grey, http://eligrey.com | |
* Public Domain. | |
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. | |
*/ |
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
import os | |
import os.path | |
import sys | |
from graphite.render.hashing import ConsistentHashRing | |
## Settings | |
# Absolute path to the Graphite Data Directory | |
DATA_DIR = '/data/graphite/whisper/' | |
## You need not modify anything below this |
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
upstream thin { | |
server unix:/tmp/thin.0.sock; | |
server unix:/tmp/thin.1.sock; | |
server unix:/tmp/thin.2.sock; | |
} | |
server { | |
listen 80; | |
server_name my-domain-name.com |
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 node_static = require('node-static'); | |
var node_static_file = new(node_static.Server)('./client'); | |
var http = require('http'), | |
players = {}, | |
server = http.createServer(function(req, res) { | |
// static file server | |
req.addListener('end', function () { | |
node_static_file.serve(req, res); | |
}); | |
}).listen(80); |
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 Module | |
def subclasses | |
classes = [] | |
ObjectSpace.each_object do |klass| | |
next unless Module === klass | |
classes << klass if self > klass | |
end | |
classes | |
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
base = 10 | |
def radix_sort(x, max): | |
radix = 1 | |
while radix < max: | |
x = counting_sort(x, radix) | |
radix *= base | |
return x | |
def counting_sort(a, radix): |
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 debounce(fn, wait) { | |
var timeout = null; | |
return function () { | |
clearTimeout(timeout); | |
var args = arguments; | |
var ctx = this; | |
timeout = setTimeout(function () { | |
fn.apply(ctx, args); | |
}, wait); | |
} |
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
// Defining constructor function | |
function ObjectConstructor(message) { | |
// TODO: Add your own initialization code here | |
this.message = message || 'Hello Prototype World!'; | |
}; | |
// Defining an instance function | |
ObjectConstructor.prototype.sayHello = function() { | |
alert(this.message); | |
}; |
NewerOlder