Skip to content

Instantly share code, notes, and snippets.

View HandyAndyShortStack's full-sized avatar

Andy Short HandyAndyShortStack

View GitHub Profile
import threading, sys, os
import cPickle as pickle
import simplejson, requests
decoder = simplejson.JSONDecoder()
error_pages = {'section_pages': [], 'xml_pages': [], 'course_pages': []}
def getCourseNumbers(page):
@HandyAndyShortStack
HandyAndyShortStack / gist:1388756
Created November 23, 2011 14:13
Note translator, Engish to lilypond
def parseNote(note):
"""translates English notes to (default) lilypond notes"""
"""takes a string consisting of a note name 'a', 'b', 'c', 'd', 'f', or 'g'
(note names can be either upper or lower case)
optionally followed by a '#' or 'b' to signify sharps and flats, followed by
an octave number corresponding to the note's piano octave.
returns a default lilypond representation of the note in absolute octave
notation. Spaces are ignored. returns None if the input is invalid."""
@HandyAndyShortStack
HandyAndyShortStack / nono.py
Created December 27, 2011 18:57
nono_optimizer
### This is a calculator to tell you how many lemene and cosmox to make
### if you are about to cook up some serious nono. You will need the
### requests and simpleson libraries and your own oauth token with read access.
import requests, simplejson
token = '' # put token with read access here
uri = ''.join(["http://api.glitch.com/simple/players.inventory?oauth_token=",
token])
@HandyAndyShortStack
HandyAndyShortStack / sparkly.py
Created January 18, 2012 08:34
sparkly maximization calculator
class Compound():
def __init__(self, red, green, blue, shiny, price, name):
self.red = red
self.green = green
self.blue = blue
self.shiny = shiny
self.price = float(price)
self.name = name
def elements(self):
return (self.red, self.green, self.blue, self.shiny)
@HandyAndyShortStack
HandyAndyShortStack / index.html
Created July 29, 2012 04:58
authentication test for TS API
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Nono Calculator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="http://www.glitch-strategy.com/w/images/2/23/NoNoPowder469.png">
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
<style>
// This is public domain code written in 2011 by Jan Wolter and distributed
// for free at http://unixpapa.com/js/querystring.html
//
// Query String Parser
//
// qs= new QueryString()
// qs= new QueryString(string)
//
// Create a query string object based on the given query string. If
// no string is given, we use the one from the current page by default.
@HandyAndyShortStack
HandyAndyShortStack / index.html
Created July 29, 2012 07:28
front page for TS API test
<!DOCTYPE html>
<html>
<a href="https://api.glitch.com/oauth2/authorize?response_type=token&client_id=437-19317577bb4d4924be3681e4e0cbea95656bacb4&redirect_uri=http://bl.ocks.org/d/3196168/&scope=read">click here</a>
</html>
{"url": "http://www.youtube.com/watch?v=ETh0Kfxk2BY"}
@HandyAndyShortStack
HandyAndyShortStack / index.html
Last active December 14, 2015 06:29
one of those dot games
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<p>yo</p>
</body>
@HandyAndyShortStack
HandyAndyShortStack / MontyHall.js
Last active December 14, 2015 18:48
monty hall problem
rollDie = function() {
var coin = Math.random();
if (coin < (1 / 3)) {
return 0;
} else if (coin < (2 / 3)) {
return 1;
} else {
return 2;
}
};