Skip to content

Instantly share code, notes, and snippets.

View mnewt's full-sized avatar

Matthew Newton mnewt

View GitHub Profile
@mnewt
mnewt / gist:2860939
Created June 3, 2012 01:52
git reference
#set up git on project directorygit init
git add .
git commit -m "Initial commit"
#set up remote push
git remote add origin git@github.com:mattnewton/app_name.git
git push origin master
#initial heroku setup
#download and install heroku toolbelt
@mnewt
mnewt / gist:2860940
Created June 3, 2012 01:52
mac rails dev install
#install xcode
#install xcode command line tools (from Xcode preferences)
#install osx-gcc-installer
#install homebrew
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
#install rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source /Users/matt/.rvm/scripts/rvm
rvm requirements
brew install libksba
@mnewt
mnewt / dabblet.css
Created August 13, 2012 21:32
Title box overlap mirror
/**
* Title box overlap mirror
*/
.title {
position: absolute; left: 25px; top: 25px; }
.content-box {
position: relative; left: 50px; top: 50px;
@mnewt
mnewt / proxy-toggle.sh
Created September 13, 2012 20:00
trivial command to toggle Mac OS X SOCKS proxy
#!/bin/sh
PROXY_INTERFACE="USB Ethernet"
PROXY_HOST=localhost
PROXY_PORT=1080
if [[ $1 == "on" ]]; then
sudo networksetup -setsocksfirewallproxy "$PROXY_INTERFACE" $PROXY_HOST $PROXY_PORT
echo "SOCKS proxy enabled"
@mnewt
mnewt / walk.js
Created October 23, 2012 04:45
walk the dom
// Define a walk_the_DOM function that visits every
// node of the tree in HTML source order, starting
// from some given node. It invokes a function,
// passing it each node in turn. walk_the_DOM calls
// itself to process each of the child nodes.
var walk_the_DOM = function walk(node, func) {
func(node);
node = node.firstChild;
while (node) {
walk(node, func);
@mnewt
mnewt / Gemfile
Created October 26, 2012 15:25 — forked from rafaelss/Gemfile
rack static site
source "http://rubygems.org"
gem 'rack-contrib', :git => 'git://github.com/rack/rack-contrib.git'
gem 'rack-rewrite'
@mnewt
mnewt / gist:4033768
Created November 7, 2012 19:20 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@mnewt
mnewt / mac-database.txt
Created November 7, 2012 22:11
mac address lookup script
# $Id$ generated with make-mac-prefixes.pl
# Original data comes from http://standards.ieee.org/regauth/oui/oui.txt
# These values are known as Organizationally Unique Identifiers (OUIs)
# See http://standards.ieee.org/faqs/OUI.html
# We have added a few unregistered OUIs at the end.
000000 Xerox
000001 Xerox
000002 Xerox
000003 Xerox
000004 Xerox
@mnewt
mnewt / bootstrap-tabs.html
Created December 6, 2012 20:28
bootstrap tabs example
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Le styles -->
<link href="../bootstrap/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
</head>
<body>
@mnewt
mnewt / loader.py
Created December 6, 2012 20:34
load python modules from directory
## {{{ http://code.activestate.com/recipes/436873/ (r2)
#!/usr/bin/env python
"""
loader.py - From a directory name:
1: append the directory to the sys.path
2: find all modules within that directory
3: import all modules within that directory
4: filter out built in methods from those modules