Skip to content

Instantly share code, notes, and snippets.

@bennlich
bennlich / jitsufirebaselog
Created September 4, 2012 08:30
nodejitsu deploy error w/ firebase
info: Creating snapshot 0.1.0-28
info: Updating app agentcloud
info: Activating snapshot 0.1.0-28 for agentcloud
info: Starting app agentcloud
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
warn: Error returned from Nodejitsu
error: Error: connect ECONNREFUSED
error: at errnoException (net.js:768:11)
error: at Object.afterConnect [as oncomplete] (net.js:759:19)
@bennlich
bennlich / watchPosition(agent) NEW
Created September 4, 2012 20:29
problematic use of firebase api
function watchPosition(agent) {
agent.dataRef.child("coords").once("value", function(coords) {
if (coords.val()) {
console.log("Has coords!");
agent.dataRef.child("coords").on("value", function(coords) {
var lat = coords.child("lat").val();
var lon = coords.child("lon").val();
var patch = getPatchAt(lat, lon, 3);
if (patch) agent.setData("patch", patch.url);
var bogart = require('bogart');
var router = bogart.router();
router.get('/', function(req) {
return bogart.middleware.respondWithFile(req, 'index.html');
});
var app = bogart.app();
app.use(bogart.batteries);
app.use(router);
@bennlich
bennlich / historic-data-structures.js
Created October 21, 2013 01:05
Possible CK data structures
// v1
{
birth_certificate: {
lat: 54,
lon: 22,
etc: etc
},
data: {
height: 4,
@bennlich
bennlich / gist:7104763
Created October 22, 2013 17:35
die() behavior with while loop
var count = 0;
while (agent.patchRightAndAhead(0,1).isWall()) {
agent.rotate(Math.PI/2);
count++;
if (count >= 3) {
agent.die();
}
}
@bennlich
bennlich / agentscript-dat.gui.js
Created December 15, 2013 07:31
agentscript-dat.gui.js
(function() {
ABM.DatGUI = (function() {
function DatGUI(fbui) {
var self = this;
this.gui = new dat.GUI();
this.model = {};
this.fbui = fbui;
fbui.fb.on('child_added', function(uiSnap) {
var uiEl = uiSnap.val(),
@bennlich
bennlich / gist:dabfa6b0a5841e88a707
Created December 2, 2014 07:46
service pattern example
/* global angular, google */
angular.module('app')
.service('router', ['$q', function($q){
var router = new google.maps.DirectionsService();
this.getRoutePromise = function(_origin, _destination) {
var deferred = $q.defer();
var request = {

Keybase proof

I hereby claim:

  • I am bennlich on github.
  • I am bennlich (https://keybase.io/bennlich) on keybase.
  • I have a public key whose fingerprint is A621 9222 6545 374F 4324 3C6A DE6B EC4D C354 EAC4

To claim this, I am signing this object:

var customEnvelope = {
levels: [0, 1, 0],
times: [0.5, 0.5]
};
var gateDef = {
ugen: "flock.ugen.sequencer",
durations: [1, 1, 1],
values: [1, 1, 1],
options: {
@bennlich
bennlich / gist:006079ab3ce479a717bc
Last active March 26, 2016 02:48 — forked from mcdonc/gist:3898894
oh my god i'm using emacs to reindent html in sublime text 2
# Sublime's HTML reindenting is currently pretty bad. And Tidy and xmllint
# change my code in ways I don't really like or need. I just need the thing
# reindented sanely. Emacs did that pretty well.
#
# One thing led to another. A few drinks later and now I'm using Emacs to
# reindent HTML from within Sublime.
#
# Save the contents of this file as ohmygodemacs.py in your User directory.
# Then save the contents of the following docstring as ohmygodemacs.elisp in your
# User directory