Skip to content

Instantly share code, notes, and snippets.

View billiegoose's full-sized avatar

Billie Hilton billiegoose

View GitHub Profile
\documentclass{jhwhw}
\author{Christopher S. Corley}
\title{Class homework solutions}
\date{October 19, 2011}
\begin{document}
\problem{Some problem name}
blahblah
\solution
@billiegoose
billiegoose / Dict.js
Last active December 18, 2015 23:08
Dict Object for JavaScript
/*
* Dict Object for JavaScript (https://gist.github.com/wmhilton/5859079)
* Author: William Hilton (wmhilton@gmail.com)
* License: http://opensource.org/licenses/MIT
*
* Say you want something like a Python "dictionary" or a Java "map" where you
* are storing (String key, Object value) pairs. It's tempting to do it using
* object properties in JavaScript, since
* obj['key'] = value
* works so conveniently. However, say you want to be able to have some properties
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@billiegoose
billiegoose / ArduinoSerialBypass.ino
Created July 19, 2013 01:37
Use your Arduino as a direct USB to serial converter! Tested on an Arduino Duemilanove. Probably 3.3V TTL but worked for communicating with my supposedly 5V TTL HerkuleX servo at 115200 baud.
/*
* Arduino Serial Bypass - use an Arduino as a dumb USB 2 Serial Converter
*
* This code makes the Arduino not interfere with pins 0 and 1
* which are connected to RX and TX on the FTDI chip. This allows
* the data coming from the FTDI USB 2 Serial chip to flow directly
* to another device. Since RX and TX are labeled from the Arduino's
* point of view, don't cross the wires, but plug the device's
* RX wire into the RX pin 0 and the TX wire into the TX pin 0.
*
@billiegoose
billiegoose / index.html
Last active August 29, 2015 14:01 — forked from NPashaP/.block
UI for editing tree graph structures
<!DOCTYPE html>
<!-- Written by William Hilton -->
<!-- Derived from the "Graceful Tree Conjecture" by NPashaP @ https://gist.github.com/NPashaP/7683252 -->
<head>
<meta charset="utf-8" />
<!-- This is for the trash bin icon. -->
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet" />
<style>
.oval-box {
background: white;
@billiegoose
billiegoose / git-log-alias.sh
Created May 21, 2014 15:45
git lg: the best git log alias
#!/bin/bash
git config --global --unset alias.lg; git config --global alias.lg "log --graph --abbrev-commit --decorate --date=relative -10 --format=format:'%C(bold blue)%h%C(reset) %C(bold yellow)%d%C(reset) %C(white)%s%C(reset) %C(green)(%ar)%C(reset) %C(dim white)- %an%C(reset)'"
@billiegoose
billiegoose / Express Parameter Parsing Demo.md
Last active August 29, 2015 14:09
Simple Express Parameter Parsing Demo

Simple Express Parameter Parsing Demo

  1. git clone https://gist.github.com/a5656b01c35d6f25dda7.git demo
  2. cd demo
  3. npm install
  4. npm start

Look at the purty code. See how the magic be done.

@billiegoose
billiegoose / vanilla-cookies.js
Created January 24, 2015 02:23
Vanilla Cookies - a dead simple yet full-featured JavaScript cookie library
// Vanilla Cookies - a dead simple yet full-featured JavaScript cookie library
// derived from http://stackoverflow.com/a/19189846
/*********************************************************
Gets the value of a cookie.
**********************************************************/
getCookie = function(sName)
{
var oCrumbles = document.cookie.split(';');
for(var i=0; i<oCrumbles.length;i++)
/* Straight stolen from http://bl.ocks.org/dwtkns/4686432 */
window.worlddata = {"type":"Topology","transform":{"scale":[0.03600360036003601,0.017366249624962495],"translate":[-180,-90]},"objects":{"land":{"type":"MultiPolygon","arcs":[[[0]],[[1]],[[2]],[[3]],[[4]],[[5]],[[6]],[[7,8]],[[9,10]],[[11]],[[12]],[[13]],[[14]],[[15]],[[16]],[[17]],[[18]],[[19]],[[20]],[[21]],[[22]],[[23]],[[24]],[[25]],[[26]],[[27]],[[28,29]],[[30]],[[31]],[[32]],[[33]],[[34]],[[35]],[[36]],[[37]],[[38]],[[39]],[[40]],[[41,42]],[[43]],[[44]],[[45]],[[46,47,48,49]],[[50]],[[51]],[[52]],[[53]],[[54]],[[55]],[[56]],[[57]],[[58]],[[59]],[[60]],[[61,62]],[[63]],[[64]],[[65]],[[66]],[[67]],[[68]],[[69]],[[70]],[[71]],[[72]],[[73]],[[74]],[[75,76]],[[77]],[[78]],[[79]],[[80]],[[81]],[[82]],[[83]],[[84]],[[85]],[[86]],[[87]],[[88]],[[89,90]],[[91]],[[92]],[[93]],[[94]],[[95]],[[96]],[[97]],[[98]],[[99]],[[100]],[[101]],[[102]],[[103]],[[104]],[[105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,
@billiegoose
billiegoose / upsert.sql
Created November 9, 2015 16:45 — forked from KyleGobel/upsert.sql
Insert/Update Upsert Trigger in Postgres
CREATE OR REPLACE FUNCTION upsert_user()
RETURNS trigger AS
$upsert_user$
declare
existing record;
begin
if (select EXISTS(select 1 from users where user_id = NEW.user_id)) then
select user_name, user_class, user_age into strict existing from users where user_id = new.user_id;