Skip to content

Instantly share code, notes, and snippets.

View peelman's full-sized avatar

Nick Peelman peelman

View GitHub Profile
@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 / 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 / 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;