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 hud = function(msg, length) { | |
| var length = length || 2; | |
| window.hudBuffer = window.hudBuffer || []; | |
| window.hudBuffer.push(msg); | |
| if(window.hudBuffer.length > length) { | |
| window.hudBuffer.shift(); | |
| } | |
| hudString = ""; |
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() { | |
| var Stats = function() { | |
| var d = document.createElement("div"); | |
| d.setAttribute("style","color:#fff;font-size:10px;position:absolute;top:2px;left:2px;width:80;height:30px;padding:5px;z-index:1000;background:rgba(0,0,0,0.85);"); | |
| document.getElementsByTagName("body")[0].appendChild(d); | |
| this.d = d; | |
| this.stats = {}; | |
| this.measurements = {}; | |
| }; |
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
| // Create an instance of winston using our settings file determined by NODE_ENV | |
| var winston = require( 'winston' ), | |
| settings = ( process.env.NODE_ENV === 'production' ) | |
| ? require( '../settings.json' ).production.logger | |
| : require( '../settings.json' ).development.logger | |
| var transports = []; | |
| if( settings.console ) { |
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
| namespace('test', function () { | |
| desc('Run server tests'); | |
| task('server', [], function () { | |
| jake.exec('mocha spec', function () { | |
| console.log('Server tests passed'); | |
| complete(); | |
| }); | |
| }); | |
| desc('Run client tests'); |
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
| /*global*/ | |
| /*jslint node:true*/ | |
| 'use strict'; | |
| var http = require( 'http' ), | |
| url = require( 'url' ), | |
| events = require( 'events' ), | |
| util = require( 'util' ), | |
| FakeServer; |
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
| oldSpeakAddition := Number getSlot("+") | |
| Number + := method( a, | |
| if( a == 2 and self == 2, 5, self oldSpeakAddition( a ) ) | |
| ) | |
| writeln( 1 + 1 ) # prints "2" | |
| writeln( 1 + 2 ) # prints "3" | |
| writeln( 2 + 2 ) # prints "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
| oldDivision := Number getSlot("/") | |
| Number / := method( a, | |
| if( a <= 0, 0, self oldDivision( a ) ) | |
| ) | |
| writeln( 1 / 2 ) # prints "0.5" | |
| writeln( 1 / 1 ) # prints "1" | |
| writeln( 1 / 0 ) # prints "0" |
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
| class Tree | |
| attr_accessor :children, :node_name | |
| def initialize(tree) | |
| tree.each { |name, branches| | |
| @node_name = name | |
| @children = [] | |
| branches.each_slice(1) { |branch| | |
| @children.push(Tree.new(branch)) | |
| } |
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
| from facepy import GraphAPI | |
| import json | |
| # connect to facebook | |
| oauth_access_token = [TOKEN_HERE] | |
| graph = GraphAPI(oauth_access_token) | |
| # get friend list |
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 IndexRoutes = require( 'index' ); | |
| var indexRoutes; | |
| indexRoutes = routes.generate({ | |
| config = options.config; | |
| logger = options.logger; | |
| Metric = options.Metric; | |
| }); |
OlderNewer