This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mutex | |
def self.busy? | |
@busy ||= false | |
end | |
def self.engage | |
@busy = true | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Users/cloudfactory001/.rvm/rubies/ruby-2.1.2/bin/ruby | |
require 'colorize' | |
path = ARGV[0] | |
unless path | |
print "Usage:".colorize(:red) | |
puts "\tvinstall <username>/<repo-name>".colorize(:green) | |
print "Example:".colorize(:red) | |
puts "vinstall tpope/vim-rails".colorize(:green) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'delegate' | |
class Person | |
attr_accessor :fname, :lname | |
def category | |
'manav' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# open gem specified by bundler in vim | |
# Usage: gopen activemerchant | |
function gopen() { | |
gem_path=`bundle show $1`; | |
cd $gem_path && vim $gem_path; | |
cd -; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cleanup merged git branches | |
function cleanlocal() { | |
echo "Before cleanup:"; | |
git branch; | |
echo "----"; | |
git branch --merged | grep -v "\*" | xargs -n 1 git branch -D; | |
echo "----"; | |
echo "After cleanup:"; | |
git branch; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install go | |
go get github.com/laher/goxc | |
# build cross-compilers | |
goxc -t | |
# create a project in $GO_PATH/src/<project-dir> | |
# inside project-dir | |
# build binaries for different platforms | |
goxc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mail -s "Cool Subject" [email protected] <<EOF | |
map <silent> <C-i> :NERDTreeToggle<CR> | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/18936633/rails-update-js-erb-not-executing-javascript | |
# http://stackoverflow.com/questions/3412375/jquery-ajax-haml-js-erb-files-not-firing | |
# IN SHORT: | |
# use the following code in controller: | |
respond_to do |format| | |
format.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias vi="DYLD_FORCE_FLAT_NAMESPACE=1 vim" | |
alias vim="DYLD_FORCE_FLAT_NAMESPACE=1 vim" |