Skip to content

Instantly share code, notes, and snippets.

View peelman's full-sized avatar

Nick Peelman peelman

View GitHub Profile
@peelman
peelman / JS GPS Coordinate Object.html
Created January 23, 2012 21:23
Javascript GPS Coordinate Object
<!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;
@peelman
peelman / known_hosts_autocomplete.sh
Created February 8, 2012 21:03
Bash AutoComplete from known_hosts
# 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
@peelman
peelman / strings.js
Created February 18, 2012 05:55
Useful JS String Extensions
// 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('-','');});
@peelman
peelman / bbdiff
Created May 22, 2012 21:12
Use TextMate to impersonate BBEdit for use with GitBox
#!/bin/bash
diff -u $1 $2 | mate -w
@peelman
peelman / flagWithReminder.scpt
Created June 27, 2012 05:08
Alfred Extension: Flag a Message with Reminder
-- 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
@peelman
peelman / traceroute
Created July 10, 2012 17:28
MediaTemple Traceroute
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
@peelman
peelman / gist:3170689
Created July 24, 2012 15:32 — forked from tonyarnold/gist:3162762
Git config aliases for markdown release notes
[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"

Ruby Global Setup

  1. Install homebrew.
  2. brew install rbenv ruby-build
  3. echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
  4. rbenv install 2.2.0
  5. rbenv global 2.2.0
  6. rbenv rehash
  7. gem install bundler rails
@peelman
peelman / underpressure.js
Created October 7, 2013 19:48
Code Results from Under Pressure
function doubleInteger(i) {
// i will be an integer. Double it and return it.
i = i*2
return i;
}