- Install homebrew.
brew install rbenv ruby-build
echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
rbenv install 2.2.0
rbenv global 2.2.0
rbenv rehash
gem install bundler rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>GPS Coords</title> | |
<script> | |
var map; | |
var info; | |
var latitude; | |
var longitude; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add to ~/.bash_profile, and close/reopen a shell. Will autocomplete any hosts found in known_hosts. | |
complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from: http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/ | |
//Trim String | |
String.prototype.trim = function(){ | |
return this.replace(/^\s+|\s+$/g, ""); | |
}; | |
//Camel Case | |
String.prototype.toCamel = function(){ | |
return this.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
diff -u $1 $2 | mate -w |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Flag a Message and Set a Reminder | |
-- https://gist.github.com/3001622 | |
-- ©2012 Nick Peelman http://peelman.us | |
-- | |
-- Thanks to Don Southard for his Create Reminders Task | |
-- http://dirtdon.com | |
set tomorrow to ((current date) + (1 * days)) | |
tell application "Mail" | |
set manyMessages to selection | |
repeat with aMessage in manyMessages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My IP 199.66.67.83 | |
traceroute to media.alfredapp.com (205.186.187.196), 64 hops max, 72 byte packets | |
1 router (192.168.0.1) 2.565 ms 2.380 ms 2.226 ms | |
2 10.194.48.3 (10.194.48.3) 8.981 ms 11.225 ms 7.986 ms | |
3 10.192.0.4 (10.192.0.4) 8.239 ms 9.902 ms * | |
4 69.174.129.30 (69.174.129.30) 11.136 ms 8.505 ms 7.980 ms | |
5 66.62.16.9 (66.62.16.9) 13.233 ms 17.418 ms 15.681 ms | |
6 lax1-core-02.360.net (66.62.3.5) 55.225 ms 13.259 ms 15.662 ms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
co = checkout | |
tagsbydate = for-each-ref --sort=-taggerdate --format='%(refname:short)' refs/tags | |
previoustag = !sh -c 'git tagsbydate --count 2 | cut -f2 | sed -n 2p' | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- | |
markdownlog = log --color --pretty=format:'* %s `%Cred%h%Creset` - %C(bold blue)[%an](mailto:%ae)%Creset' --abbrev-commit --dense --no-merges --reverse | |
releasenotes = !sh -c 'git markdownlog ...`git previoustag`' | |
tree = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --decorate" | |
fix = "commit --amend -C HEAD" | |
di = "diff --color" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doubleInteger(i) { | |
// i will be an integer. Double it and return it. | |
i = i*2 | |
return i; | |
} |
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
OlderNewer