View config.ru
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
require 'faye' | |
require 'logger' | |
Faye::WebSocket.load_adapter('thin') | |
faye = Faye::RackAdapter.new(:mount => '/faye', :timeout => 25) | |
#Define hash to store metrics each time a monitoring event occurs in the server | |
event_metrics = { | |
:connections => {count: 0, latest_timestamp: nil}, | |
:active_subscriptions => {count: 0, latest_timestamp: nil}, |
View Makefile
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
export PATH := node_modules/.bin:$(PATH) | |
source_files := $(wildcard lib/*.coffee) | |
build_files := $(source_files:%.coffee=build/%.js) | |
template_source := templates/*.handlebars | |
template_js := build/templates.js | |
app_bundle := build/app.js | |
spec_coffee := $(wildcard spec/*.coffee) | |
spec_js := $(spec_coffee:%.coffee=build/%.js) |
View async.js
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 foo | |
async.waterfall([ | |
function(cb) { | |
getThingFromDB("foo", cb) | |
}, function(_foo, cb) { | |
foo = _foo | |
getOtherThingFromDB(foo, "bar", cb) | |
}, function(bar, cb) { | |
qux(foo, bar) |
View user.js
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 crypto = require("crypto") | |
var User = function(attributes) { | |
this._attributes = attributes || {} | |
} | |
User.KEY_LENGTH = 32 | |
User.WORK_FACTOR = 20000 | |
User.prototype.setPassword = function(password, callback) { |
View dogecoin.txt
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
\ / | |
\ so / | |
\ / | |
much X very | |
/ \ | |
/ wow \ | |
/ \ |
View browser.js
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 cheerio = require("cheerio"), | |
path = require("path"), | |
request = require("request"), | |
url = require("url"), | |
_ = require("underscore") | |
var Browser = function(userAgent, origin) { | |
this.location = url.parse(origin) | |
this._cookies = request.jar() | |
this._headers = {"Accept": "text/html", "User-Agent": userAgent} |
View app.js
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 express = require("express"), | |
fs = require("fs"), | |
http = require("http"), | |
path = require("path") | |
var app = express() | |
app.use(express.static(path.resolve(__dirname, "public"))) | |
app.get("/", function(request, response) { |
View websocket_spec.js
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 JS = require("jstest"), | |
async = require("async"), | |
WebSocket = require("faye-websocket").Client, | |
Browser = require("../../chatroom/spec/browser"), | |
store = require("../../orm/store"), | |
User = require("../../orm/persisted_user"), | |
app = require("../app") | |
JS.Test.describe("WebSockets", function() { with(this) { | |
before(function(resume) { with(this) { |
View callbacks.js
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
// fs_stat :: String -> (Error -> Stat -> ()) -> () | |
var fs_stat = _.curry(fs.stat, 2); | |
// paths :: [String] | |
var paths = ['file1.txt', 'file2.txt', 'file3.txt']; | |
// tmp :: [(Error -> Stat -> ()) -> ()] | |
var tmp = paths.map(oneparam(fs_stat)); | |
// async.parallel :: [(Error -> a -> ()) -> ()] -> (Error -> [a] -> ()) -> () |
View migrate_sti_models.rb
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
# Migrate from this: | |
class ListItem < ActiveRecord::Base | |
belongs_to :group | |
acts_as_list scope: :group | |
# has id and type columns | |
end | |
class Audio < ListItem | |
end |
OlderNewer