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 / 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 / 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
autoload colors
if [[ "$terminfo[colors]" -gt 8 ]]; then
colors
fi
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
eval $COLOR='$fg_no_bold[${(L)COLOR}]'
eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]'
done
eval RESET='$reset_color'
@mnewt
mnewt / prose-vcprompt-virtualenv.sh
Created December 9, 2012 00:46
modified version of prose theme prompt for zsh/oh-my-zsh
# virtualenv
VIRTUAL_ENV_DISABLE_PROMPT="true"
function virtualenv_info {
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
}
function vcprompt_info {
vcprompt --format-git "on ± %{$fg[magenta]%}%b%{$reset_color%}%{$fg[green]%}%u%m%a%{$reset_color%}" \
--format-hg "on ☿ %{$fg[magenta]%}%b%{$reset_color%}%{$fg[green]%}%u%m%{$reset_color%}" \
--format "on %s %{$fg[magenta]%}%b%{$reset_color%}%{$fg[green]%}%u%m%{$reset_color%}"
@mnewt
mnewt / emacs.css
Created December 10, 2012 00:37 — forked from themactep/formtocookie.js
How to save form to cookies, restore form from cookies. Requires jQuery and jQuery Cookie plugin.
.highlight .hll { background-color: #ffffcc }
.highlight { background: #f8f8f8; }
.highlight .c { color: #008800; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #AA22FF; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .cm { color: #008800; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #008800 } /* Comment.Preproc */
.highlight .c1 { color: #008800; font-style: italic } /* Comment.Single */
.highlight .cs { color: #008800; font-weight: bold } /* Comment.Special */