Skip to content

Instantly share code, notes, and snippets.

View rwaldron's full-sized avatar

Rick Waldron rwaldron

  • Boston, MA
View GitHub Profile
@rwaldron
rwaldron / cipreq.bash
Created December 3, 2012 21:36 — forked from kswedberg/cipreq.bash
commit pull request
cipreq() {
if [ -z "$1" ]
then
echo `git log -1 --no-merges --pretty=format:'git commit -a --author="'"%an <%aE>"'" --message="'"%s %b"'"'`
return 1
fi
AUTHOR=$1
@rwaldron
rwaldron / gist:4177441
Created November 30, 2012 18:06 — forked from paulirish/gist:4158604
Learn JavaScript concepts with recent DevTools features

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.

Closures

Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

@rwaldron
rwaldron / helloworld.js
Created November 29, 2012 01:06 — forked from max-mapper/helloworld.js
droneduino
var serialport = require('node-serialport')
var sp = new serialport.SerialPort("/dev/ttyO3", {
parser: serialport.parsers.raw,
baud: 9600
})
sp.on('data', function(chunk) {
console.log(chunk.toString('hex'), chunk.toString(), chunk)
})
@rwaldron
rwaldron / webmail.js
Created November 9, 2012 00:16 — forked from mauricesvay/webmail.js
Controlling cheap USB LED notifiers with nodejs and node-hid
/* Controlling cheap USB LED notifiers with node-hid */
var Notifier = function(hid) {
this.hid = hid;
this.colors = ['OFF', 'BLUE', 'RED', 'GREEN', 'CYAN', 'PURPLE', 'YELLOW', 'WHITE'];
};
Notifier.prototype.write = function(arBytes) {
this.hid.write(arBytes);
};
Notifier.prototype.color = function(value) {
@rwaldron
rwaldron / routing.md
Created October 26, 2012 17:03 — forked from wycats/routing.md

It All Starts With Templates

An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.

<header>
  <img src="masthead">
</header>

<footer>
@rwaldron
rwaldron / TDZ.js
Created October 22, 2012 17:05 — forked from dherman/TDZ.js
temporary dead zone
// ---------------------------------------------------------------------
// 1. UNCONTROVERSIAL AMONGST TC39
// ---------------------------------------------------------------------
// read before write throws
{
console.log(x); // throws
let x = 12;
console.log(x);
}
@rwaldron
rwaldron / cipr.sh
Created October 16, 2012 18:35 — forked from kswedberg/cipr.sh
alias for git commit line merging head -1
alias cipr="git log -1 --pretty=format:'git commit -a --author="'"%an <%aE>" --message="%s %b"'"'"
@rwaldron
rwaldron / nextTick.js
Created October 14, 2012 22:14 — forked from mmalecki/nextTick.js
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}
@rwaldron
rwaldron / index.js
Created October 3, 2012 14:58 — forked from twolfson/index.js
Trying spaces over zeroes for led-matrix
" 11 11 ",
"1 11 1",
"1 1",
"1 1",
" 1 1 ",
" 1 1 ",
" 11 ",
" "
vs

These instructions work for the Raspberry Pi running Raspbian (hard float) and create a hardware optimized version of NodeJS for the Raspberry PI, (and include a working install and NPM!!!):

  1. Install Raspbian - http://www.raspberrypi.org/downloads

  2. Install the necessary dependecies:

sudo apt-get install git-core build-essential

(If you just installed git then you need to administer your git identity first, else adding the patches below will fail!!!)