Skip to content

Instantly share code, notes, and snippets.

View wayneeseguin's full-sized avatar
🤪

Wayne E Seguin wayneeseguin

🤪
View GitHub Profile
@wayneeseguin
wayneeseguin / gist:674648
Created November 12, 2010 20:47
Simple example of using the RVM Ruby API
#
# NOTE: You may require ~/.rvm/lib/rvm after adding ~/.rvm/lib to the load path $:
# OR 'gem install rvm' and require the RVM API as a gem!
#
require "rvm"
results = []
#
# Iterate over an RVM Environment object for each interpreter
@wayneeseguin
wayneeseguin / bashrc
Created November 23, 2010 20:38 — forked from orlandolopez/bashrc
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
: # no-op
fi
PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
function rvmised_prompt {
n_cols=$(tput cols)
rvm_prompt="$(rvm-prompt)"
let rvm_ppos=$n_cols-${#rvm_prompt}
tput sc # save cursor
tput cuf $rvm_ppos; tput setaf 1 # right justified and in red
echo -n $rvm_prompt
tput sgr0 # may not always work as expected
tput rc # restore cursor
This is a pet project of mine called Twidget. The idea is to make selling random stuff you have SUPER easy and social. I basically hate Craigslist and eBay for selling stuff as I find them to be a pain in the ass. I have a closet full of crap that I literally want to snap a picture of and hope someone offers me money. That's twidget.
The app is mostly mobile. Here are the main features:
- A user registers or logs on via Facebook or Twitter. They are prompted to add the other one after registering (i.e. if you use FB after registering it prompts you to connect Twitter and vice versa)
- Once logged in the user have THREE options - sell, buy or promote. The default is the sell screen, which is just a camera (See below).
- SELL - user can take a picture of anything. They are then prompted for a title, price and location (based on a geo-location API, like foursquare). They can also post an optional description. Price defaults to $5.00. When they hit SELL IT it gets posted to their facebook and/or t
@wayneeseguin
wayneeseguin / gist:733937
Created December 8, 2010 21:23
Selecting based on Ruby Version
group :development do
if RUBY_VERSION =~ /1.9/
gem "ruby-debug19"
else
gem "ruby-debug"
fi
end
@wayneeseguin
wayneeseguin / gist:737153
Created December 11, 2010 04:45
RVM bootstrapping script for Jeffa
#!/bin/bash
banner()
{
printf '
______________________________________________
| _____ ____ _ _ |
| | ____|__ _ ___ _ _ | _ \ __ _(_) |___ |
| | _| / _` / __| | | | | |_) / _` | | / __| |
| | |__| (_| \__ \ |_| | | _ < (_| | | \__ \ |
I wrote a bash git-install script. Toward the end, I do:
echo "Edit ~/.bash_profile to load ~/.git-completioin.bash on Terminal launch"
echo "source ~/.git-completion.bash" >> ~/.bash_profile
The problem is, if you run the script more than once, you end up appending this line multiple times to ~/.bash_profile. How do I use bash scripting with grep or sed (or another option you may recommend) to only add the line if it doesn't yet exist in the file. Also, I want to add the line to ~/.profile if that file exists and ~/.bash_profile doesn't exist, otherwise just add it to ~/.bash_profile.
@wayneeseguin
wayneeseguin / Attribution
Created January 1, 2011 21:32
TextMate shell function to open project directory excluding some.
Original code from:
http://www.wezm.net/technical/2009/05/exclude-directories-from-textmate-side-bar-for-faster-find-in-project/
@wayneeseguin
wayneeseguin / gist:774785
Created January 11, 2011 17:45
zsh chpwd example
my_chpwd()
{
if [[ -s "$PWD/set_env" ]] ; then
source "$PWD/set_env"
echo '(automatically sourced set_env)'
fi
#Shouldn't that be more this?
# curl https://github.com/wayneeseguin/rvm/raw/master/scripts/install | grep -v '^#'
set -o errtrace
export PS4='+[${BASH_SOURCE}] : ${LINENO} : ${FUNCNAME[0]:+${FUNCNAME[0]}() $ }'
if [[ -z "$rvm_selfcontained" ]]; then
if [[ $(id | sed -e 's/(.*//' | awk -F= '{print $2}') -eq 0 || \