Skip to content

Instantly share code, notes, and snippets.

View nsbingham's full-sized avatar

Nathan Bingham nsbingham

  • optional
  • United States
View GitHub Profile
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 28, 2025 00:02
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jkresner
jkresner / Global.asax
Created October 30, 2012 20:20
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" })
}
}
@pjlammertyn
pjlammertyn / HandlebarsBundleTransform.cs
Created July 31, 2012 07:11 — forked from kylefritz/HandlebarsBundleTransform.cs
Compile Ember Handlebars Templates in .net mvc (2 options: first using postbuild, second using a bundle transform)
using System.IO;
using System.Text;
using System.Web;
using System.Web.Optimization;
using Jurassic;
namespace Fewt.Web
{
public class EmberHandlebarsBundleTransform : IBundleTransform
{
var mongoose = require('./../mongoose');
var Schema = mongoose.Schema;
var sleep = 1000;
var timer;
var db = mongoose.createConnection();
db.on('error', function () {
// error on startup
console.error('conn error', arguments);
@jboner
jboner / latency.txt
Last active May 8, 2025 06:10
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@serbrech
serbrech / init.sh
Created April 25, 2012 18:37
This is how I bootstrap my envoironment. It's a small shellscript that will open a new tab and run the command past as argument to it.
#!/bin/sh
# Credits goes to http://stackoverflow.com/questions/1589114/opening-a-new-terminal-tab-in-osxsnow-leopard-with-the-opening-terminal-window#answer-7911097
# I just slightly modified it to take an argument.
new_tab() {
pwd=`pwd`
osascript -e "tell application \"Terminal\"" \
-e "tell application \"System Events\" to keystroke \"t\" using {command down}" \
-e "do script \"cd $pwd; clear; $1;\" in front window" \
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@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"/>
@codepo8
codepo8 / resizer.js
Created February 1, 2012 15:20
Resize image to thumbnail size
function resize( imagewidth, imageheight, thumbwidth, thumbheight ) {
var w = 0, h = 0, x = 0, y = 0,
widthratio = imagewidth / thumbwidth,
heightratio = imageheight / thumbheight,
maxratio = Math.max( widthratio, heightratio );
if ( maxratio > 1 ) {
w = imagewidth / maxratio;
h = imageheight / maxratio;
} else {
w = imagewidth;
@paulirish
paulirish / rAF.js
Last active April 17, 2025 15:06
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];