Skip to content

Instantly share code, notes, and snippets.

View shanewholloway's full-sized avatar
🗜️
I may be slow to respond.

Shane Holloway shanewholloway

🗜️
I may be slow to respond.
View GitHub Profile
.boxy {
margin: 15px;
outline: 1px dashed red;
width: 200px;
height: 150px;
border: 1px solid white;
padding: 10px;
position: relative;
}
.boxy>div {
@shanewholloway
shanewholloway / gist:3536969
Created August 30, 2012 18:35
Convert Billings.app exported slip ".bex" file into Freckle-style CSV
import csv
import glob
import plistlib
clientProject = 'My Project'
for filename in glob.glob("*.bex"):
root = plistlib.readPlist(filename)
with open(filename+'.csv', 'wb') as out:
out = csv.writer(out)
out.writerow(['Date', 'Person', 'Client/Project', 'Minutes', 'Tags', 'Description', 'Billable', 'Invoiced', 'Invoice Reference'])
@shanewholloway
shanewholloway / microweb.js
Created December 11, 2012 22:11
microweb.js creates very basic structure for implementing a tiny NodeJS server
// [© 2012 Bellite.io](http://bellite.io)
// Open Source as [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/)
// vim: sw=2 ts=2 expandtab
"use strict";
var
path = require('path'), fs = require('fs'),
http = require('http'), url = require('url'),
querystring = require('querystring')
exports.createMicroWebServer = createMicroWebServer;
@shanewholloway
shanewholloway / objFromForm.js
Created December 11, 2012 22:12
objFromForm.js is a small set of javascript to populate and restore a form to Javascript objects — and therefore JSON.
// [© 2012 Bellite.io](http://bellite.io)
// Open Source as [CC BY-SA 3.0](http://creativecommons.org/licenses/by-sa/3.0/)
// vim: sw=2 ts=2 expandtab
(function(exports) {
"use strict";
function objFromForm(form, dispatch) {
if (!form || form.nodeName!="FORM") return;
dispatch = dispatch || objFromForm.dispatch
var res={}, elem, fn
@shanewholloway
shanewholloway / walkTree.js
Last active December 16, 2015 08:48
Quick recursive directory walker modeled after python's `os.walk`
var fs=require('fs'), path=require('path')
var walkTree = (function() {
function WalkNode(path) {
this.path=path; this.dirs=[]; this.files=[]; }
WalkNode.prototype.dirPaths = function() {
return this.dirs.map(function(ea) {
return path.join(this.path, ea) }, this) }
WalkNode.prototype.filePaths = function() {
return this.files.map(function(ea) {
@shanewholloway
shanewholloway / ab_tracker.js
Created May 22, 2013 22:43
Small and simple A/B testing tool. - Only supports two option 50/50 tests. On purpose. - Open-ended backend tracking. - Uses localStorage instead of cookies to cut down on bandwidth waste.
// Licensed [CC-BY Shane Holloway](http://creativecommons.org/licenses/by/3.0/)
function ab_tracker(track) {
"use strict";
ab_test.store = window.localStorage || null;
ab_test.prefix = 'ab_test::'
ab_test.track = track
if (typeof track !== 'function')
throw new Error('`track` must be a function');
var truth = {'true':true, 'false':false, null:null};
@shanewholloway
shanewholloway / Bellite.h
Created June 11, 2013 15:46
Bellite C library header files
/*
* Bellite is a library for creating desktop applications on Mac OSX and Windows
* using HTML5 platform technologies. Learn more at http://bellite.io
*
* Copyright (C) 2012 Bellite.io
*/
#pragma once
#if defined(SWIG)
@shanewholloway
shanewholloway / README.md
Last active December 21, 2015 12:59
Barycentric coordinates for vertices of an Apollonian network

After reading about [Easy wireframe display with Barycentric coordinates][3], I started thinking about generating those coordinates uniquely for each vertex.

Is it possible to assign each vertex of an [Apollonian network][1] a single Barycentric coordinate, such that the Barycentric coordinate would be unique for each triangle to which the vertex belongs? For example, a [Triakis Tetrahedron][2] is polyhedron with an Apollonian graph structure.

For instance in the example network here, can a function B(m) be defined to give Barycentric coordinates valid for triangles mnp, mon, and mpo?

@shanewholloway
shanewholloway / EventLoop.js
Last active August 29, 2015 14:13
NodObjC EventLoop implementation
/* Cocoa application event loop implementation for NodObjC.
* Code created for https://github.com/TooTallNate/NodObjC/pull/56
* Working as of 2015-Jan-11 on Mac OS 10.10, Node 0.10.35, NodObjC 1.0.0
*
* Copyright (c) 2015, Shane Holloway
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
@shanewholloway
shanewholloway / EventLoop.js
Last active May 30, 2017 08:22
Demo applicationDidFinishLaunching using NodObjC EventLoop
/* Cocoa application event loop implementation for NodObjC.
* Code created for https://github.com/TooTallNate/NodObjC/pull/56
* Working as of 2015-Jan-11 on Mac OS 10.10, Node 0.10.35, NodObjC 1.0.0
*
* Copyright (c) 2015, Shane Holloway
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/