Skip to content

Instantly share code, notes, and snippets.

@rmurphey
rmurphey / gist:3309079
Created August 9, 2012 23:39
Move a servo with a joystick
var five = require("../lib/johnny-five.js"),
board, servo, joystick;
board = new five.Board();
board.on("ready", function() {
var status = new five.Led(13);
status.on();
servo = new five.Servo({
@rmurphey
rmurphey / gist:3308827
Created August 9, 2012 23:02
Change the color of an LED based on accelerometer orientation
var five = require("../lib/johnny-five.js"),
board, distance, vibration, accel,
red, green, blue;
board = new five.Board();
board.on("ready", function() {
var status = new five.Led(13);
status.on();

Hey. So, we're writing because we're people who spend a lot of time in #jquery helping others -- people like you who are trying to get their bearings with jQuery or JavaScript or who are maybe struggling through some problem that's got them particularly stumped.

We've noticed that you've been kind of, well, dominating the channel a lot lately -- sort of like you're talking through every problem you're running into while you're working on your app, and sometimes repeating your inquiries when you don't get a response. We want to be helpful, we really do, but the constant stream of questions is ... well, it's led to a lot of us just tuning you out, and that's probably not what you want.

So: our biggest request is that you show a little more effort at working through your problems on your own, rather than announcing them in the channel shortly after you encounter them. Below are a few other suggestions; some are based on our experience, while others are from the excellent post about [help vampires](http://sla

@rmurphey
rmurphey / lcd.js
Created July 29, 2012 18:53 — forked from haugstrup/lcd.js
LCD proof of concept for johnny-five
// Wire up LCD as described here:
// http://learn.adafruit.com/character-lcds/overview
var five = require("johnny-five"),
board, lcd;
board = new five.Board();
board.on("ready", function() {
@rmurphey
rmurphey / gist:3185390
Created July 27, 2012 00:27
shiftOut in javascript
var five = require("johnny-five"),
board;
board = new five.Board();
board.on("ready", function() {
(new five.Led(13)).on();
var dataPin = 2;
var clockPin = 3;
@rmurphey
rmurphey / gist:3164584
Last active October 7, 2015 12:27
Assessment problems for Foundations of Programming with JavaScript

Problem 1

Use JavaScript to write a function that takes a number as its argument. If the number is less than 10, the function should return "small"; if the number is 10 or greater, but less than 100, the function should return "medium"; if the number is 100 or greater, the function should return "large".

Problem 2

Use JavaScript to write a function that takes a number as its argument. If the number is between 1 and 10 (inclusive), return the word for that number (that is, if the number passed to the function is 2, return the word "two"). If the number is not between 1 and 10, return false.

@rmurphey
rmurphey / gist:3105199
Created July 13, 2012 14:30 — forked from paulirish/gist:3098860
Open Conference Expectations

Open Conference Expectations

This document lays out some baseline expectations between conference speakers and conference presenters. It was prepared by three experienced conference speakers -- one of whom has also organized conferences -- and influenced by many others. Its goal is to let speakers know what they might reasonably expect from a conference, in exchange for the hours we expect them to spend researching, preparing, and rehearsing, and the time they will spend away from home and family.

We believe that all speakers should reasonably expect these things, not just speakers who are known to draw large crowds, because no one is a rockstar but more people should have the chance to be one. We believe that conferences are better -- and, dare we say, more diverse -- when the people speaking are not just the people who can afford to get themselves there, either because their company paid or they foot the bill themselves.

These expectations should serve as *a starting point for discussion between sp

@rmurphey
rmurphey / gist:3104761
Created July 13, 2012 12:57 — forked from paulirish/gist:3098860
Open Conference Expectations

Open Conference Expectations

This document lays out some baseline expectations between conference speakers and conference presenters. It was prepared by three veteran conference speakers, and influenced by many others. Its goal is to let speakers know what they might reasonably expect from a conference, in exchange for the hours we expect them to spend researching, preparing, and rehearsing, and the time they will spend away from home and family.

We believe that all speakers should reasonably expect these things, not just speakers who are known to draw large crowds, because no one is a rockstar but more people should have the chance to be one. We believe that conferences are better -- and, dare we say, more diverse -- when the people speaking are not just the people who can afford to get themselves there, either because their company paid or they foot the bill themselves.

These expectations should serve as a starting point for discussion between speaker and organizer. They are not a list of demands

@rmurphey
rmurphey / gist:3098867
Created July 12, 2012 15:29 — forked from paulirish/gist:3098860
Open Conference Expectations

Open Conference Expectations

For conferences, it's extremely important that attendees get top-quality content from industry experts. As a highly compelling format of educating others based on experience and research, conferences stand to be one the best sources of refined knowledge available. Still, it's important for a successful event to have a few guidelines to ensure quality content from the best and most appropriate speakers. Below is a set of guidelines for conference organizers that ensure quality content for attendees and the community.

What We, As Speakers, Expect from Conferences

  1. Video recordings: Organizers should prioritize recording all talks and sessions. A conference that only teaches the ~300 people in the room has constrained value and is not worthwhile to a speaker who wants to benefit the community. When recorded, video will be available online under a permissive license (CC-BY-*) within six months of the event.

  2. Reimbursement: Conferences will reimburse travel and rea

@rmurphey
rmurphey / gist:3086328
Created July 10, 2012 21:23
What's wrong with Netmag's "Optimize your JavaScript" post

What's wrong with Netmag's "Optimize your JavaScript" post

Update: The original post on Netmag has been updated since this was written.

I tweeted earlier that this should be retracted. Generally, these performance-related articles are essentially little more than linkbait -- there are perhaps an infinite number of things you should do to improve a page's performance before worrying about the purported perf hit of multiplication vs. division -- but this post went further than most in this genre: it offered patently inaccurate and misleading advice.

Here are a few examples, assembled by some people who actually know what they're talking about (largely Rick Waldron and Ben Alman, with some help from myself and several others from the place that shall be unnamed).

Things that are just plain wrong