Skip to content

Instantly share code, notes, and snippets.

View ChapmanSnowden's full-sized avatar

Chapman Snowden ChapmanSnowden

  • San Francisco, CA
View GitHub Profile
@ChapmanSnowden
ChapmanSnowden / README.md
Last active November 9, 2017 19:55 — forked from leapjs/README.md
Documentation

For the Web

This is an introductory reference for interfacing with the Leap Motion from JavaScript.

The Leap's driver runs a WebSocket server that streams gesture data to the browser. This lets users run gesture-based web applications immediately without downloading or installing any software.

Quick Start

Here's a simple program to explore the hue/saturation colorspace with one hand.

This chart compares the BRIC countries (Brazil, Russia, India and China) with a new group of upstarts, MIST (Mexico, Indonesia, South Korea, Turkey). The data are from the World Bank. It was my attempt to achieve object constancy for multiple sets of time series data. I used d3.nest() to sort one big CSV file based on each economic indicator, then used d3.key() on the header row (the countries) to make ensure constancy. Check the boxes at the top to highlight the country groups. An interpretation of this visual can be found on my website.

function Gauge(placeholderName, configuration)
{
this.placeholderName = placeholderName;
var self = this; // for internal d3 functions
this.configure = function(configuration)
{
this.config = configuration;

#Rails vs. Sinatra: Routes

Routes are mostly the same in Rails as they are in Sinatra, except in Rails your controller and route action are separated. Specifically, your routes call your controller actions. In Sinatra, your routes are your controllers.

##Routes in Sinatra In sinatra, you'd have in app/controllers/index.rb, resembling this:

    get '/' do #this is the route
 @grandma = params[:grandma] #the next two lines are the action
@ChapmanSnowden
ChapmanSnowden / index.html
Created August 21, 2013 02:06 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@ChapmanSnowden
ChapmanSnowden / form-validator.js
Created August 15, 2013 17:31 — forked from ksolo/form-validator.js
Form Validation
// shorthand for $(document).ready();
$(function(){
//Your code...
});
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
*/
class Vehicle
attr_reader :color, :wheels, :status, :passengers, :speed, :choice #Why reader and not accessor? Use all of these because they are ubiquitous to all subclasses
def initialize(args)
@color = args(:color)
@status = args(:stopped)
@speed = args(:normal)
@choice = ["true", "false", "true", "false", "true"]
end