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 / cons.html
Created February 14, 2011 18:43
Exercise to understand Lisp cons/car/cdr, by implementing in JS
<script src="cons.js"></script>
@rwaldron
rwaldron / pot.js
Last active July 27, 2026 16:18 — forked from jochasinga/pot.js
// Require modules
var Firebase = require("firebase");
var five = require("johnny-five");
// Create a new instance of Firebase db
var firebaseRef = new Firebase(
// Fictional URL: replace this with your own from firebase
"https://burning-limbo-666.firebaseio.com/colors"
);
@rwaldron
rwaldron / style-guide.js
Created January 24, 2011 18:20
Writing Idiomatic JavaScript
1. Two space soft indents (fake tabs) OR tabs... BUT NEVER BOTH - DO NOT MIX
2. Whitespace, Parens, Braces, Linebreaks
if/else/for/while/try always have spaces, braces and multiple lines.
--------------------------------------------------------------------
@rwaldron
rwaldron / i2c.js
Last active November 11, 2025 14:26 — forked from jem-computer/i2c.js
var five = require('../lib/johnny-five.js'),
board, button;
board = new five.Board();
board.on("ready", function() {
this.firmata.sendI2CConfig();
var LSM303_CTRL_REG1_A = 0x20
, LSM303_CTRL_REG2_A = 0x21
@rwaldron
rwaldron / branch-count.sh
Created June 15, 2011 16:08
Count number of branches in a repo
git branch | wc -l
@rwaldron
rwaldron / Setting up Google Cloud Storage with CORS for Web Fonts.md
Created January 16, 2018 21:47 — forked from mhulse/Setting up Google Cloud Storage with CORS for Web Fonts.md
Setting up CORS on Google Cloud Storage: An unofficial quick start guide to serving web fonts from Google's cloud. (I'm sure a lot of this info could be improved... Please leave comments if you have tips/improvements.)

Login:

Google Cloud Storage

You'll want to login using an official Google account (i.e. if this is for your company, use the comapany Gmail account vs. a personal one.)

When logging in, you might be prompted to verify the account; if so, enter your cell number to get a verification e-mail or phone call.

Once verified, you'll have to agree to the terms of service; do that, and click continue.

Strict Mode: The Summary!

Identifiers (variables, functions) cannot be named any of these: "implements", "interface", "let", "package", "private", "protected", "public", "static", and "yield"

OctalLiterals are not allowed.

@rwaldron
rwaldron / weakmap.js
Created May 9, 2011 22:54
Example of WeakMap usage. Run in Firefox Nightly (>6.x)
var k = {}, v,
w = new WeakMap();
w.set( k, "value" );
console.log(
w.get( k )
);
// ...At some point the program no longer needs this
<?php
header("Content-Type: text/event-stream\n\n");
echo 'data: ' . json_encode(
array(
0 => array(
'time' => time(),
'message' => 'Some kind of foo'
),
1 => array(
/*!
* jQuery JavaScript Library v2.1.1pre
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license