Skip to content

Instantly share code, notes, and snippets.

View jasonmorganson's full-sized avatar

Jason Morganson jasonmorganson

View GitHub Profile
@jasonmorganson
jasonmorganson / Node.build-system
Created July 18, 2011 13:48
Node build "system" for Sublime Text 2
{
"cmd": ["killall node >> /dev/null; node ${file}"],
"selector": "source.javascript",
"path": "/usr/bin",
"shell": true
}
@jasonmorganson
jasonmorganson / gist:1160591
Created August 21, 2011 13:07
Backbone.js view rendering using weld.js
render: ->
@el.innerHTML = document.querySelector( if @id then '#'+@id else '.'+@className ).innerHTML
weld( @el, @model.attributes )
@
// Cross-browser object.watch and object.unwatch
// object.watch
if (!Object.prototype.watch) {
Object.prototype.watch = function (prop, handler) {
var oldval = this[prop], newval = oldval,
getter = function () {
return newval;
},
setter = function (val) {
@jasonmorganson
jasonmorganson / gist:1239478
Created September 24, 2011 15:56
Serve CoffeeScript, Jade, Stylus with Zappa.js and connect-assets.
zappa = require 'zappa'
zappa ->
@configure =>
@set 'view engine': 'jade'
@use require('connect-assets')()
@jasonmorganson
jasonmorganson / web.js
Created September 19, 2012 21:12
Simple static file server using Express
var express = require( 'express' ),
consolidate = require( 'consolidate' ),
app = express();
var port = process.env.PORT || 80;
// Assign the jade engine to .html files
app.engine( 'html', consolidate.jade );
// Set .html as the default extension
@jasonmorganson
jasonmorganson / .bash_profile
Created December 8, 2012 01:08
Responsive Prompt
# Create a flexible, responsive prompt.
# Based on the Responsive Prompt
# http://jondavidjohn.com/blog/2012/12/how-to-accomplish-a-responsive-bash-prompt
working_directory() {
dir=`pwd`
in_home=0
if [[ `pwd` =~ ^$HOME($|\/) ]]; then
dir="~${dir#$HOME}"
@jasonmorganson
jasonmorganson / system.sh
Last active December 12, 2015 06:48
System configuration
#!/bin/bash
#
# Install with the following command:
#
#
# wget -q -O - https://gist.github.com/jmorganson/4731470/raw/system.sh | sh
# wget -q -O - http://files.morganson.net/system.sh | sh
# Ensure that the script is run as root
@jasonmorganson
jasonmorganson / user.sh
Last active August 15, 2018 18:31
User configuration
#!/usr/bin/env sh
#
#
# Run with the following command:
#
#
#   wget -q -O - https://gist.github.com/jasonmorganson/4733446/raw/user.sh | sh
#   wget -q -O - http://user.morganson.net | sh
#!/usr/bin/env sh
# Location of executables
IPSET=/usr/sbin/ipset
IPTABLES=/sbin/iptables
# Common definitions
COMMENT="-m comment --comment"
LOG="ULOG --ulog-nlgroup 1 --ulog-prefix"
DONT_LOG=""
@jasonmorganson
jasonmorganson / world
Last active December 14, 2015 00:09
Gentoo world configuration
app-admin/eselect
app-admin/logrotate
app-admin/sudo
app-admin/syslog-ng
app-admin/ulogd
app-editors/nano
app-editors/vim
app-misc/ca-certificates
app-misc/pax-utils
app-misc/tmux