Skip to content

Instantly share code, notes, and snippets.

# add headers
$ echo ‘#include “Arduino.h”’ > blink.cpp
# add sketch
$ cat blink.ino >> blink.cpp
# add int main()
$ cat /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/main.cpp >> blink.cpp
# build binary
var findit = require('findit')('./posts');
findit.on('file', function(file, stat) {
(fs.createReadStream(file)).pipe(through(function(data) {
this.queue(marked(data.toString()));
})).pipe(process.stdout);
});
@mulderp
mulderp / index.js
Created August 31, 2014 08:11
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 200
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
Light stream: 0.1728515625,0.171875,0.1728515625,0.171875,0.1728515625,0.1728515625,0.1728515625,0.171875,0.1728515625,0.1728515625,
Sound stream: 0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.0166015625,0.017578125,0.017578125,0.017578125,0.017578125,
Light stream: 0.1728515625,0.1728515625,0.171875,0.1728515625,0.1728515625,0.1728515625,0.1728515625,0.171875,0.171875,0.1728515625,
Sound stream: 0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,
Light stream: 0.1728515625
Current Light level: 0.1728515625
Sound stream: 0.017578125
Current Sound level: 0.017578125
Light stream: 0.171875,0.171875,0.171875,0.171875,0.171875,0.1728515625,0.171875,0.1728515625,0.1728515625,0.171875,
Sound stream: 0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,0.017578125,
[{"homeScore":1,"awayScore":3,"currentGameMinute":null,"startTime":"2014-06-14T19:00:00.000Z","status":"Final","venue":"Estádio Governador Plácido Aderaldo Castelo (Fortaleza, Ceará)","group":"D","awayTeamId":"F77B348A-D7AE-4534-8ADA-8E52BEE64744","homeTeamId":"088C4113-CEFC-460C-830C-277C148C0CE7","id":"5CE66431-86C1-4BDB-8D9E-A07C238AE4B9","type":"Match"},{"homeScore":1,"awayScore":2,"currentGameMinute":null,"startTime":"2014-06-14T22:00:00.000Z","status":"Final","venue":"Arena Amazônia (Manaus, Amazonas)","group":"D","awayTeamId":"B61B25AA-CD8E-4778-AC26-DD08D7851990","homeTeamId":"2EFCFEB2-EBF8-4628-B659-B00C49D93811","id":"F07CB601-072A-4B11-91D7-DD36ABE6E98A","type":"Match"},{"homeScore":0,"awayScore":0,"currentGameMinute":null,"startTime":"2014-06-21T22:00:00.000Z","status":"Pre-game","venue":"Arena Pantanal (Cuiabá, Mato Grosso)","group":"F","awayTeamId":"74EA3831-DA4A-4093-B1E3-FD4EB45AA798","homeTeamId":"028EDCA8-6D1E-49CC-8442-A7A12E921E09","id":"26D94370-47AF-46A6-BA3E-8DFFB062B815","type":"Match"
[{"name":"Netherlands","logo":"http://cache.images.globalsportsmedia.com/soccer/teams/150x150/1552.png","website":"http://www.knvb.nl","foundedYear":1889,"address":"Woudenbergseweg 56-58\n3700 AM\nZeist","homeStadium":"Amsterdam ArenA","stadiumCapacity":53052,"group":"B","groupRank":1,"groupPoints":3,"matchesPlayed":1,"wins":1,"losses":0,"draws":0,"goalsFor":5,"goalsAgainst":1,"goalsDiff":"+4","id":"FB6842E6-BB62-450D-98C0-A062610E6518","type":"Team"},{"name":"Chile","logo":"http://cache.images.globalsportsmedia.com/soccer/teams/150x150/424.png","website":"http://www.anfp.cl","foundedYear":1895,"address":"Avenida Quilín 5635, Comuna Peñalolén\nSantiago de Chile","homeStadium":"Estadio Nacional Julio Martínez Prádanos","stadiumCapacity":66660,"group":"B","groupRank":2,"groupPoints":3,"matchesPlayed":1,"wins":1,"losses":0,"draws":0,"goalsFor":3,"goalsAgainst":1,"goalsDiff":"+2","id":"9A319800-C80A-4FD9-9679-125D27246FB0","type":"Team"},{"name":"Australia","logo":"http://cache.images.globalsportsmedia.com/soccer
@mulderp
mulderp / gist:890eb3b7473b98a3a91a
Created June 13, 2014 16:18
CURL for worldcup API
curl --include --request GET "http://www.kimonolabs.com/api/ebkx0v2e?apikey=e228ca86c4c0624bfc30722ea22d7180"
@mulderp
mulderp / gist:22174782ebe36bce0c50
Created May 21, 2014 06:33
get access token via Twitter oauth
#!/usr/bin/env node
var argv = require('optimist')
.usage('Usage: --key=[consumer key] -secret=[consumer secret]')
.demand(['key', 'secret'])
.argv
;
var OAuth = require('oauth').OAuth;
var Step = require('step');
@mulderp
mulderp / gist:11349911
Created April 27, 2014 16:33
returns undefined ?
var Sync = function(syncing, options) {
this.syncing = syncing;
this.url = syncing.url;
this.delay = syncing.delay;
}
_.extend(Sync.prototype, {
findAll: Promise.method(function() {
var sync = this;
return Promise.bind(this).then(function() {
@mulderp
mulderp / gist:9740253
Created March 24, 2014 13:40
serverbone test
global.serverbone = require("serverbone");
global.BaseModel = serverbone.models.BaseModel;
global.redis = require("redis");
global.RedisDb = require('backbone-db-redis');
global.store = new RedisDb('mymodel', redis.createClient());
global.movieSchema = {
id: 'schemas/movies',
type: 'object',