Skip to content

Instantly share code, notes, and snippets.

View chrisbolin's full-sized avatar
❤️

Chris Bolin chrisbolin

❤️
View GitHub Profile
@chrisbolin
chrisbolin / csv-to-sql-table.bash
Created January 10, 2015 23:00
Create MySQL Table from CSV File
## prints create and insert SQL statements from a csv ##
# csv-to-table [path] [name]
# $ csv-to-table ./data.csv data_table
# create table adapted from John Swapceinski,
# http://dev.mysql.com/doc/refman/5.0/en/load-data.html#c12001
path=$(pwd)
@chrisbolin
chrisbolin / queue.js
Last active August 29, 2015 14:09
Firebase Work Queue
// ref.transaction() can be used in place of ref.set()
queueChildRef.transaction(function(theItem) {
dataToProcess = theItem;
if(theItem) {
return null; // if there is still a value, delete it and claim job
} else {
return; // if there is not a value, abort transaction. job already claimed
}
}, function(error, committed, snapshot, dummy) {
if (error) throw error;
@chrisbolin
chrisbolin / about.md
Last active August 29, 2015 14:08
Firebase Circular Buffer

A circule buffer for firebase. Elements are dequeued and enqueue, and a callback function is run on their dataSnapshot.

@chrisbolin
chrisbolin / serve.py
Last active March 22, 2023 13:53
Python SimpleHTTPServer for Static Serving (React / Angular / Ember) in HTML5 mode (a la mod_rewrite)
'''
Taken from:
http://stackoverflow.com/users/1074592/fakerainbrigand
http://stackoverflow.com/questions/15401815/python-simplehttpserver
'''
import SimpleHTTPServer, SocketServer
import urlparse, os
PORT = 3000
@chrisbolin
chrisbolin / app.js
Last active August 29, 2015 14:07
Stupid Simple Angular Boilerplate
"use strict";
angular
.module('app', [])
.controller('HomeController', HomeController);
function HomeController ($scope) {
$scope.hello = "oh, hi"
}