Skip to content

Instantly share code, notes, and snippets.

View thomasboyt's full-sized avatar

Thomas Boyt thomasboyt

View GitHub Profile
@thomasboyt
thomasboyt / harmonograph.pde
Created October 6, 2012 13:05
Harmonograph in Processing
float d[] = new float[4];
float f[] = new float[4];
float p[] = new float[4];
float E = exp(1);
PVector current_pt;
PVector center;
void setup() {
@thomasboyt
thomasboyt / sierpinski.pde
Created November 3, 2012 09:33
sierpinski
class EqTriangle {
public float x, y, h, w;
EqTriangle(float xx, float yy, float hh, float ww) {
x = xx;
y = yy;
h = hh;
w = ww;
}
//copy
@thomasboyt
thomasboyt / default.js
Created November 4, 2012 01:25
WinJS pt.1 Code Samples
(function () {
"use strict";
WinJS.Binding.optimizeBindingReferences = true;
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
app.onactivated = function (args) {
if (args.detail.kind === activation.ActivationKind.launch) {
from xml.etree import ElementTree
import re, random, os, json, argparse
### Initial parsing & table creation
# Parse through the dialog XML file and take all of the dialogue out for parsing, removing character names
def parse_xml():
tree = ElementTree.parse("dialog.xml")
root = tree.getroot()
myObj.prototype.setupHandler() {
someElement.addEventListener('click', function(e) {
this.someOtherFunction(e.target);
}.bind(this));
}
@thomasboyt
thomasboyt / gist:5247752
Last active December 15, 2015 10:39
JSSD Gist thing test
Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=latin1">
<style type="text/css">
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
// Defines a live, embedded hasMany relationship that updates automatically
// models
App.ChatRoom = DS.Firebase.LiveModel.extend({
title: DS.attr("text"),
messages: DS.hasMany("App.Message", {live: true})
});
App.Message = DS.Firebase.LiveModel.extend({
@thomasboyt
thomasboyt / constants.js
Last active December 16, 2015 11:38
LeapJS Cursors
// calibration constants
// this was for a 13" MacBook Pro with the Leap horizontally centered and placed on the
// table against the front edge of the laptop
// left and right edges of the screen. may be the opposite of what you want, depending
// on the orientation of your Leap
var X_LEFT = -140;
var X_RIGHT = 140;
// heights for the top and bottom of the screen
@thomasboyt
thomasboyt / ex.js
Created April 25, 2013 00:15
theoretical queued saving pattern
var MyModel = DS.Model.extend({
// ...
saveQueued: false,
save: function() {
Ember.run.sync(); //may actually need to be a Ember.run.once(function() {...}) wrapper
if (this.get("stateManager.currentState.name" == "inFlight")) {
if (!this.get("saveQueued")) {
this.set("saveQueued", true);
this.one("didSave", function() {
Ember.run.sync();