Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jrolfs's full-sized avatar

Jamie Rolfs jrolfs

View GitHub Profile
@jrolfs
jrolfs / server.js
Created April 24, 2012 02:22
Node.js, Express, node-http-proxy development server
var express = require('express'),
routingProxy = require('http-proxy').RoutingProxy(),
app = express.createServer();
var apiVersion = 1.0,
apiHost = my.host.com,
apiPort = 8080;
function apiProxy(pattern, host, port) {
return function(req, res, next) {
@jrolfs
jrolfs / proxycookie.js
Created April 25, 2012 15:43
Express Node.js web server that forwards proxied cookies
var express = require('express'),
proxy = require('http-proxy'),
app = express.createServer();
var routingProxy = new proxy.RoutingProxy();
var apiHost = process.argv[2] ? process.argv[2] : 'my.api.com';
var apiPort = process.argv[3] ? process.argv[3] : '8080';
var apiPrefix = process.argv[4] ? process.argv[4] : '1.1';
function onApiProxyEnd(req, res, proxyHeaders) {
@jrolfs
jrolfs / redlints.xml
Created August 2, 2012 21:43
SublimeLinter red inline highlights
<dict>
<key>name</key>
<string>SublimeLinter Error Outline</string>
<key>scope</key>
<string>sublimelinter.outline.illegal</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#440000</string>
<key>foreground</key>
@jrolfs
jrolfs / backbone-accessors.js
Created August 29, 2012 19:52
Backbone accessor methods
var MyView = Backbone.View.extend((function () {
// ---------- Private ----------
var _cantTouchThis = 0;
var _template;
return {
@jrolfs
jrolfs / rjs-static-private-const.js
Created August 30, 2012 04:52
RequireJS module with 'static private const' (mind the scare quotes)
define(function () {
'use strict';
// ---------- Constants ----------
var MY_STATIC_PRIVATE_CONST = 'only here, every instance, plz don\'t change meh';
var TEMPLATE = '<div></div>';
var MyView = Backbone.View.extend((function () {
@jrolfs
jrolfs / jquery.spin.centered.js
Last active October 12, 2015 19:28
Modified spin.js jQuery plugin
// See: https://gist.github.com/1290439
/*
You can now create a spinner using any of the variants below:
$('#el').spin(); // Produces default Spinner using the text color of #el.
$('#el').spin('small'); // Produces a 'small' Spinner using the text color of #el.
$('#el').spin('large', 'white'); // Produces a 'large' Spinner in white (or any valid CSS color).
$('#el').spin({ ... }); // Produces a Spinner using your custom settings.
@jrolfs
jrolfs / id_rsa.pub
Created November 27, 2012 00:18
My public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCxP1Oh8CnRJJM4pLbloF7FkR+WYuOHRvjTVrWyow9OWh466iM9ZPibUfUFCZejTionsMUMx1B24pCGL4rwhNG+epRICExil5jLRGJ34YWTqQIJZvw3BVwsX91cWzDCFQ8fYl3jyFL3pWoea0Wl9juZWhu18Kbac8aimDRi52eY5q4Hjo+K2qrHeDXRTqNItNlLESAp9q012C9M/hxHuEvkzT/ie3WZGk9Q66YkbbYw0tTe50I/G8T9o8ZSrfOmSWtIhpjM09zXttwMe7/TqEHmG2lNhlNxOYt0DJGuWS43NXJ6mvQ/i9amBA9glFa2uUNbTPVN47RENb/RvdZVzhw3 Jamie@Catwoman.local
@jrolfs
jrolfs / jbuilder_derp.json
Created November 28, 2012 01:04
Weird jbuilder JSON
{
"videos": {
"[]": "widescreen",
"author": "author",
"categories": "categories",
"description": "description",
"latitude": "latitude",
"longitude": "longitude",
"media_content": "media_content",
"state": "state",
@jrolfs
jrolfs / topublic.json
Created November 29, 2012 01:14
Set video permissions to Public
{
"author": {
"name": "ytvidio",
"uri": "http://gdata.youtube.com/feeds/api/users/ytvidio"
},
"categories": [{
"term": "Film",
"label": "Film & Animation"
}],
"description": "TIL he was literally Samuel L. C(le)mons",
@jrolfs
jrolfs / abbreviate-query.less
Created November 29, 2012 02:19
Responsive Abbreviation
nav > li > a:after {
content: attr(label);
}
@media (min-width: @navbarCollapseWidth) and (max-width: 1160px) {
nav > li > a:after {
content: attr(abbr-label);
}
}