Skip to content

Instantly share code, notes, and snippets.

View nsbingham's full-sized avatar

Nathan Bingham nsbingham

  • optional
  • United States
View GitHub Profile
@nsbingham
nsbingham / gist:1189949
Created September 2, 2011 21:16
homebrew PostgreSQL install issue - output
==> Downloading http://ftp9.us.postgresql.org/pub/mirrors/postgresql/source/v9.0.4/postgresql-9.0.4.tar.bz2
File already downloaded in /Users/nathan/Library/Caches/Homebrew
/usr/bin/tar xf /Users/nathan/Library/Caches/Homebrew/postgresql-9.0.4.tar.bz2
Warning: Detected a framework Python that does not have 64-bit support in:
/Library/Frameworks/Python.framework/Versions/Current/Python
e configure script seems to prefer this version of Python over any others,
you may experience linker problems as described in:
http://osdir.com/ml/pgsql-general/2009-09/msg00160.html
@nsbingham
nsbingham / build.xml
Created April 13, 2012 20:11 — forked from jessefreeman/build.xml
Simple ImpactJS Ant Build - Use this to bake and copy your game over to a deploy folder so you can easily publish it.
<?xml version="1.0"?>
<project name="Impact Ant Build" basedir="." default="full-build">
<!-- Change these properties based on your project -->
<!-- Project meta data -->
<property name="project.name" value="Resident Raver"/>
<property name="company.name" value="GameCook"/>
<property name="company.site" value="http://gamecook.com"/>
<property name="project.version" value="0.8.1"/>
@nsbingham
nsbingham / multiplayer_inject.js
Created June 5, 2012 19:24
Multiplayer plugin code injection
// Code injected into the Entity class
ig.Entity.inject({
// Abstracting the controls
controls: {
up: false,
down: false,
left: false,
right: false
},
@nsbingham
nsbingham / multiplayer_update.js
Created June 5, 2012 19:25
Multiplayer plugin simple enemy position update
// Sync enemy positions; uses Underscore.js
_.each(data.enemies, function(e){
var enemy = this.getEntityByRemoteName(e.remoteName);
// Reset the entities position
if(enemy) {
enemy.pos = e.pos;
}
@nsbingham
nsbingham / captureit.sh
Created June 12, 2012 15:50
Bash script to capture a screenshot every 1 second on OSX
#! /usr/bin/env bash
i=0
if [ ! -d "./images" ]; then
mkdir ./images
fi
@nsbingham
nsbingham / gist:3083697
Created July 10, 2012 14:39
Issues running brew update and brew doctor
#brew update
Error: no such file to load -- tempfile
Please report this bug:
https://github.com/mxcl/homebrew/wiki/bug-fixing-checklist
/usr/local/Library/Homebrew/extend/pathname.rb:108:in `require'
/usr/local/Library/Homebrew/extend/pathname.rb:108:in `atomic_write'
/usr/local/Library/Homebrew/cmd/untap.rb:41:in `unlink_tap_formula'
/usr/local/Library/Homebrew/cmd/update.rb:32:in `update'
/usr/local/bin/brew:83:in `send'
@nsbingham
nsbingham / gist:3152673
Created July 20, 2012 19:15
Isotope masonryHorizontal gutters
// Execute this before an isotope call
// modified Isotope methods for gutters in masonryHorizontal
$.Isotope.prototype._getMasonryHorizontalGutterRows = function() {
var gutter = this.options.masonryHorizontal && this.options.masonryHorizontal.gutterWidth || 0;
containerHeight = this.element.height();
this.masonryHorizontal.rowHeight = this.options.masonryHorizontal && this.options.masonryHorizontal.rowHeight ||
// or use the size of the first item
this.$filteredAtoms.outerHeight(true) ||
@nsbingham
nsbingham / gist:3201661
Created July 29, 2012 20:24
PJAX Apache .htaccess to redirect all traffic that doesn't exist on server to index.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule (.*) index.html [L]
</IfModule>
@nsbingham
nsbingham / Global.asax
Created December 5, 2012 22:53 — forked from jkresner/Global.asax
Asp .net Mvc 4 Proxy Server/Controller (For help with Cross Domain Request)
public class WebApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
RouteTable.Routes.MapRoute("HttpProxy", "proxy/{*path}", new { controller = "Proxy", action = "Http" })
}
}
@nsbingham
nsbingham / handlebars_truncating_helper.js
Last active December 10, 2015 07:09
A simple helper to truncate values in Handlebars based on a character count.
Handlebars.registerHelper('trunc', function (context, options) {
var chars = options.hash.chars || 20;
var result = context;
if (context.length > chars) {
result = result.substring(0, chars);
if (options.hash.append) {
result += options.hash.append;