Skip to content

Instantly share code, notes, and snippets.

View tomauty's full-sized avatar
🌀
melting wind

Tom Auty tomauty

🌀
melting wind
View GitHub Profile
@tomauty
tomauty / tom_merge.cpp
Created February 16, 2012 19:02
Tom's Merge Sort
void MultiSort::mergeSort ( CSVFile &csv, vector<int> &keys )
{
//If vector size is 1, return
if (csv.get_numRows() <= 1)
{
return;
}
//Else split into two separate subvectors
CSVFile left;
@tomauty
tomauty / gist:6523927
Created September 11, 2013 13:54
Getting up to speed
These are the resources that helped me get from javascript proletariat to javascript bourgeoisie (:
Javascript: The Good Parts (General JS)
http://eleventyone.done.hu/OReilly.JavaScript.The.Good.Parts.May.2008.pdf
Hands-on Node.js (Node)
http://nodetuts.com/pdf/handson-nodejs-sample.pdf
Stream Handbook (Node)
https://github.com/substack/stream-handbook
@tomauty
tomauty / gist:c9cb43a538e781d988f7
Created January 21, 2015 19:46
pseudocode for multi-object spawning
// Say a constructed object takes three arguments and you dont need to reference them after they're constructed
args = [
[ 7, 10, true ]
[ 9, 1, true ]
[ 4, 6, true ]
[ 1, 9, false ]
]
for (i in args) {
@tomauty
tomauty / gist:71690e05cdc9163182e6
Created January 28, 2015 13:54
from FF dev tools
if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
var container, stats;
var camera, scene, renderer, objects;
var particleLight;
var dae;
var loader = new THREE.ColladaLoader();
@tomauty
tomauty / lol.js
Last active August 29, 2015 14:25
// removed "limit" from query params
var url = "http://api.tumblr.com/v2/blog/manarecs.tumblr.com/posts?api_key=2Waj1PmWwaIcu49hUVPTb4WOwWNOp1uOkhP4vjn0Fe3g7zB7Ss";
$.getJSON(url, function(results){
// The latest post is last
var latest = results.reponse.posts.reverse()[0];
// Make DOM element with this latest post data
// Not familiar enough with jQuery + page HTML to do this
});
// hover
var i = undefined;
$('a').mouseover(function() {
var dest = $(this);
var string = dest.text();
var c = 0;
dest.text('');
i = setInterval(function () {
if (c >= string.length) {
clearInterval(i);
@tomauty
tomauty / teststyle.css
Last active September 8, 2015 21:48
test style
.main-header {
display: none;
}
.page-list {
background: black;
}
@tomauty
tomauty / inv.js
Created October 3, 2015 18:59
inventory wip
import _ from 'lodash';
const _internal = new WeakMap();
class Inventory {
/**
*
* @constructs Inventory
* @classdesc An inventory is a collection of Item objects, belonging to an Entity, with a capacity
*
* @param {Entity} belongsTo - The entity that has this inventory
______) _____
(, / (, / |
/ ______ /---| _/_
) / (_) // (_ ) / |_(_(_(__(_/_
(_/ (_/ .-/
(_/
@tomauty
tomauty / rn-binding.js
Created December 11, 2015 15:36
binding to 'this'
export default class Router extends Component {
constructor(props) {
super(props);
this.renderScene = this.renderScene.bind(this);
}
componentWillReceiveProps(nextProps) {
if (this.props.router.currentRoute === nextProps.router.currentRoute) { return; }
const {closeSideMenu} = this.props;
switch (nextProps.router.type) {