Skip to content

Instantly share code, notes, and snippets.


Stanley Zheng stanzheng

View GitHub Profile
maxogden / index.js
Created Mar 16, 2014
requirebin sketch
View index.js
var Box2D = require('box2dweb-commonjs').Box2D
var vkey = require('vkey')
var raf = require('raf')
var b2BodyDef = Box2D.Dynamics.b2BodyDef
var b2Body = Box2D.Dynamics.b2Body
var b2FixtureDef = Box2D.Dynamics.b2FixtureDef
var b2World = Box2D.Dynamics.b2World
var b2CircleShape = Box2D.Collision.Shapes.b2CircleShape
var b2DebugDraw = Box2D.Dynamics.b2DebugDraw
stanzheng / meetup.js
Last active Aug 29, 2015
Meetup Raffle Script
View meetup.js
//pass in number of winners
//todo UNIQUE winners and prize mapping
var pickWinners = function(numberOfWinners){
var meetup = $(".member-name");
var winners = [];
var picked_numbers = {};
while (numberOfWinners){
var winner = Math.floor(Math.random() * meetup.length);
////bug in duplciates ins winners array
simoncollins /
Last active Aug 29, 2015
Sending messages to Tessel

This shows how to send messages to a connected Tessel over USB and how to log messages that the Tessel writes to console.log().

You'll need to do a tessel push tessel-code.js to push the script to the Tessel first as it seems you can only have one connection at a time (unless there's another way I'm not aware of).

Then run node host-code.js to send the message to Tessel. You should see Tessel log back the message it received.

metaskills / challenge.rb
Last active Aug 29, 2015
Ruby Solution To Phrase Synonym Count Winner
View challenge.rb
# 1) Write a function which takes a phrase.
# 2) Phrase is "May the force be with you"
# 3) Which of these words has the most synonyms
require 'json'
require 'net/http'
BASE_URL = "{API_KEY}&word=";
for i in `seq 1 7306`;
frame=$(printf '%06d' "$i")
echo $frame
curl "$frame.jpg&as_user=starwarsbot"
sleep 10
from fractions import Fraction as f
import math
def decompose(n):
frac = f(n)
out = []
current_denom = 1
if frac >= 1:
number = int(frac)
View F.d.ts
declare namespace F {
class Either<A, B> {
private constructor();
// Hack to make A and B covariant.
private a: A;
private b: B;
static Left<A, B>(a: A): Either<A, B>;
static Right<A, B>(b: B): Either<A, B>;
View streams.scm
;; dispatcher is a work in progress haha
(define-syntax dispatcher
(lambda (x)
(syntax-case x (else)
((d name (case1 do1 ...) ... )
(with-syntax ( (args (datum->syntax #'d 'args)) )
#'(define (name m . args)
(case m
(case1 do1 ...) ...
(else (error (symbol->string 'name) "bad operation" m)))))))))
View Graphs 2016_12_16.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
lordnynex / app.go
Created Sep 22, 2016 — forked from Bochenski/app.go
Negroni golang mgo middleware example
View app.go
package main
import (