Skip to content

Instantly share code, notes, and snippets.

View archan937's full-sized avatar
🤔
Always thinking about writing the next most creative and nifty piece of software

Paul Engel archan937

🤔
Always thinking about writing the next most creative and nifty piece of software
  • BettyBlocks
  • The Netherlands, Amsterdam
View GitHub Profile
@archan937
archan937 / inspector.js
Created March 2, 2012 22:16
Inspect Javascript objects similar to 'object.toSource()' within Mozilla. Used in IE6+, Safari, Firefox and Chrome.
function inspect(object) {
switch (typeof(object)) {
case "undefined":
return "undefined";
case "string":
return "\"" + object.replace(/\n/g, "\\n").replace(/\"/g, "\\\"") + "\"";
case "object":
if (object == null) {
return "null";
}
@archan937
archan937 / rvm_git_prompt.sh
Created May 15, 2011 10:02
Current RVM Ruby & Gemset and Git branch in your Bash prompt
function current_rvm_ruby {
color=$(tput setaf 3)
default=$(tput sgr0)
version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
full=${color}${version}${gemset}${default}
[ "$full" != "" ] && echo "$full "
}