Skip to content

Instantly share code, notes, and snippets.

View nnnnathann's full-sized avatar

Nathan Bleigh nnnnathann

  • Oberd
  • Kansas City, MO
View GitHub Profile
@nnnnathann
nnnnathann / gist:3491640
Created August 27, 2012 19:37
Reverse HTTP Proxy (Apache + nodejs)
We couldn’t find that file to show.
define(['backbone'],function(Backbone){
// Modified from from Backbone.Router v 0.9.2
var DelegatingRouter = function(args) {
if (!args.delegate) { throw("delegate is required arg to DelegateRouter"); }
if (!args.routes) { throw("routes is required arg to DelegateRouter"); }
Backbone.history || (Backbone.history = new Backbone.History);
_delegate_routes(this, args.delegate, args.routes);
// if (!Backbone.history.start({pushState: true})) {
// // window.location.href = "/404.html";
@nnnnathann
nnnnathann / gist:6002504
Created July 15, 2013 19:05
cURL TIming
#!/bin/bash
URL="$1"
DATA="$2"
MAX_RUNS="$3"
SUM_TIME="0"
i="0"
while [ $i -lt $MAX_RUNS ]; do
TIME=`curl $URL -d $DATA -o /dev/null -s -w %{time_total}`
@nnnnathann
nnnnathann / Force IE 9
Created August 19, 2013 15:47
IE9 Meta Tag
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
-- This SQL implements the Double Metaphone algorythm (c) 1998, 1999 by Lawrence Philips
-- it was translated to Python, and then to SQL from the C source written by Kevin Atkinson (http://aspell.net/metaphone/)
-- By Andrew Collins - Feb, 2007 who claims no rights to this work
-- http://www.atomodo.com/code/double-metaphone/metaphone.sql/view
-- Tested with MySQL 5.1 on Ubuntu 6.01 and Ubuntu 10.4
-- Updated Nov 27, 2007 to fix a bug in the 'CC' section
-- Updated Jun 01, 2010 to fix a bug in the 'Z' section - thanks Nils Johnsson!
-- Updated Jun 25, 2010 to fix 16 signifigant bugs - thanks again Nils Johnsson for a spectacular
-- bug squashing effort. There were many cases where this function wouldn't give the same output
-- as the original C source that were fixed by his careful attention and excellent communication.
//main.js
require.config({
paths: {
jquery: 'components/jquery',
underscore: 'components/underscore',
backbone: 'components/backbone'
},
shim: {
jquery: { exports: '$' },
underscore: { exports: '_' },
@nnnnathann
nnnnathann / connect-proxy.js
Created February 3, 2014 14:05
Connect Proxy
var url = require('url');
var httpProxy = require('http-proxy');
var proxy = new httpProxy.RoutingProxy();
module.exports = function(apiUrl, stripRoute){
return function(req,res,next){
var pathInfo = url.parse(apiUrl);
if(/^\/api/.exec(req.url)){
if(stripRoute){
req.url = req.url.replace(/^\/api/,'');
@nnnnathann
nnnnathann / gist:8889147
Last active August 29, 2015 13:56
backfire
Uncaught TypeError: Cannot set property '_remoteAttributes' of undefined backbone-firebase.js:323
Backbone.Firebase.Collection.Backbone.Collection.extend._childAdded backbone-firebase.js:323
(anonymous function) firebase.js:85
fc firebase.js:39
yd firebase.js:85
wd.Eb firebase.js:85
zd.Eb firebase.js:86
Qd.Mb firebase.js:99
r.Mb firebase.js:117
F.Xa firebase.js:13
@nnnnathann
nnnnathann / 0_reuse_code.js
Created March 17, 2014 16:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
var util = require('util'),
colors = require('colors'),
http = require('http'),
httpProxy = require('http-proxy');
var localServerIp = '192.168.1.12';
//
// Http Proxy Server with Proxy Table
//
httpProxy.createServer({