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
[ 'toplevel', | |
[ [ { name: 'var', | |
start: | |
{ type: 'keyword', | |
value: 'var', | |
line: 8, | |
col: 0, | |
pos: 127, | |
nlb: true, | |
comments_before: |
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
// Is this valid syntax? If so, might decruft the name a bit | |
function chain() use ($app) { | |
$callbacks = func_get_args(); | |
$resp = new Response; | |
return function() use ($resp, $app, $callbacks) { | |
$req = $app['request']; | |
foreach (array_reverse($callbacks) as $callback) { | |
$resp = $callback($req, $resp); | |
} | |
return $resp; |
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
<html> | |
<head> | |
</head> | |
<body> | |
<div id='fps'>0</div> | |
<canvas id='canvas' width="700" height="700"></canvas> | |
<script type='text/javascript'> | |
var canvas = document.getElementById('canvas') | |
var context = canvas.getContext('2d'); | |
var fps = document.getElementById('fps'); |
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
getListeners: (channel)-> | |
branches = ['root'].concat(channel.split(@pattern)) | |
numbranches = branches.length | |
curr = @listeners | |
walk = (a, b)-> | |
for v,i in a | |
if a[i] != b[i] then return false | |
return true | |
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
- (NSImage *)avatarIconForAvatar:(AvatarWrapper *)avatarWrapper | |
{ | |
CGFloat red = GetRValue(avatarWrapper.avatarData.color)/255.; | |
CGFloat blue = GetBValue(avatarWrapper.avatarData.color)/255.; | |
CGFloat green = GetGValue(avatarWrapper.avatarData.color)/255.; | |
NSImage *avatarBody = [[NSImage alloc] initWithContentsOfFile: | |
[[NSBundle mainBundle] pathForResource:@"avatar_icon_mask" ofType:@"png"]]; | |
NSImage *resultImage = [[[NSImage alloc] initWithSize:[avatarBody size]] autorelease]; |
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
Model = require('./model') | |
validator = require('validator') | |
sanitize = validator.sanitize | |
_ = require('underscore') | |
m = new Model({ | |
test : '', | |
num : 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
if not window? | |
inherits = require('util').inherits | |
EventEmitter = require('events').EventEmitter | |
_ = require('underscore') | |
extend = _.extend | |
keys = Object.keys | |
class Model extends EventEmitter | |
constructor: (attribs) -> |
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 chat = new Controller({ | |
view : $('#chat-content'), | |
socket: app.socket, | |
model : chatCollection | |
}); | |
chat.on('model.add', function(event){ | |
this.socket.send({ | |
type : 'chat', | |
data : event) |
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 parseCookie(str){ | |
var obj = {} | |
, pairs = str.split(/[;,] */); | |
for (var i = 0, len = pairs.length; i < len; ++i) { | |
var pair = pairs[i] | |
, eqlIndex = pair.indexOf('=') | |
, key = pair.substr(0, eqlIndex).trim().toLowerCase() | |
, val = pair.substr(++eqlIndex, pair.length).trim(); | |
// Quoted values |
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 sensitive = [ | |
{ | |
email: [email protected], | |
secret: 'somesecret', | |
username: name, | |
last_message: 'hey' | |
}, | |
{ | |
email: [email protected], | |
secret: 'somesecret2', |