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:849058
Created March 1, 2011 12:29
Git checkout function that triggers project .rvmrc to be reloaded
#
# Call git checkout
#
gco()
{
git checkout $*
if [[ -s .rvmrc ]] ; then
unset rvm_rvmrc_cwd
cd .
fi
default_run_options[:pty] = true
set :application, "bobo"
set :repository, "file:///home/poporoot/git/bobo.git"
set :local_repository, "ssh://[email protected]/home/poporoot/git/bobo.git"
set :user, 'poporoot'
set :deploy_to, "/home/poporoot/roboczy/bobo"
require 'bundler/capistrano'
#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 || \
@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
@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/
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 / gist:737153
Created December 11, 2010 04:45
RVM bootstrapping script for Jeffa
#!/bin/bash
banner()
{
printf '
______________________________________________
| _____ ____ _ _ |
| | ____|__ _ ___ _ _ | _ \ __ _(_) |___ |
| | _| / _` / __| | | | | |_) / _` | | / __| |
| | |__| (_| \__ \ |_| | | _ < (_| | | \__ \ |
@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
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
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