⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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 dgram = require('dgram'); // dgram is UDP | |
// Listen for responses | |
function listen(port) { | |
var server = dgram.createSocket("udp4"); | |
server.on("message", function (msg, rinfo) { | |
console.log("server got: " + msg + " from " + rinfo.address + ":" + rinfo.port); | |
}); |
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
/* | |
* Copyright (c) 2010 Tobias Schneider | |
* This script is freely distributable under the terms of the MIT license. | |
*/ | |
(function(){ | |
var UPC_SET = { | |
"3211": '0', | |
"2221": '1', | |
"2122": '2', |
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 FS = require('fs'); | |
var EventEmitter = require('events').EventEmitter; | |
// http://www.mjmwired.net/kernel/Documentation/input/joystick-api.txt | |
function parse(buffer) { | |
var event = { | |
time: buffer.readUInt32LE(0), | |
number: buffer[7], | |
value: buffer.readInt16LE(4) | |
} |
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
// Lack of tail call optimization in JS | |
var sum = function(x, y) { | |
return y > 0 ? sum(x + 1, y - 1) : | |
y < 0 ? sum(x - 1, y + 1) : | |
x | |
} | |
sum(20, 100000) // => RangeError: Maximum call stack size exceeded | |
// Using workaround |
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
events = | |
events: {} | |
bind: (topic, handler, context = this) -> | |
(@events[topic] ||= []).push { handler, context } | |
trigger: (topic, args...) -> | |
if @events[topic]? | |
event.handler.apply event.context, args for event in @events[topic] |
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
substack : testling-server $ npm ls | |
testling-server@0.0.0 /home/substack/projects/testling-server | |
├─┬ JSONStream@0.1.1 | |
│ └── jsonparse@0.0.1 | |
├─┬ bouncy@1.3.1 | |
│ ├── morestreams@0.0.2 | |
│ └── parsley@0.1.0 | |
├─┬ browserify@1.9.2 | |
│ ├── coffee-script@1.1.3 | |
│ ├── commondir@0.0.1 |
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
source :rubygems | |
gem 'sinatra' | |
gem 'json' | |
gem 'omniauth' | |
gem 'omniauth-oauth2' | |
gem 'omniauth-github' | |
gem 'omniauth-facebook' | |
gem 'omniauth-twitter' | |
# gem 'omniauth-att', :path => File.expand_path("./../../omniauth-att", __FILE__) |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant::Config.run do |config| | |
config.vm.box = "quantal64_vb428" | |
config.vm.customize ["modifyvm", :id, "--memory", 512] | |
config.ssh.forward_agent = true | |
config.vm.provision :chef_solo do |chef| |
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
// | |
// Copyright (c) 2012-2013 Cédric Luthi / @0xced. All rights reserved. | |
// | |
#if TARGET_IPHONE_SIMULATOR | |
static const char *fakeCarrier; | |
#import <objc/runtime.h> |