Skip to content

Instantly share code, notes, and snippets.

View hectorperez's full-sized avatar

Hector Perez hectorperez

View GitHub Profile
@hectorperez
hectorperez / plot 2 graphs in same plot in R.r
Last active August 29, 2015 14:08
plot 2 graphs in same plot in R
plot(x,y1,type="l",col="red")
lines(x,y2,col="green")
# With different axis:
plot( x, y1, type="l", col="red" )
par(new=TRUE)
plot( x, y2, type="l", col="green" )
# http://stackoverflow.com/questions/2564258/plot-2-graphs-in-same-plot-in-r
@hectorperez
hectorperez / x11_error.r
Created October 21, 2014 13:46
x11 error in r when using plot (ios)
plot(t,heading,'l')
> Error in (function (display = "", width, height, pointsize, gamma, bg, :
> X11 module cannot be loaded
quartz()
plot(t,heading,'l')
> worked
@hectorperez
hectorperez / stub example in Ruby.rb
Created October 10, 2014 14:05
stub example in Ruby
MyClass.any_instance.stub(:method).and_return(NewContent)
@hectorperez
hectorperez / check if a class already exists in Ruby.rb
Created October 7, 2014 16:57
check if a class already exists in Ruby
def class?(class_name)
Kernel.const_defined?(class_name) && class_name.constantize.is_a?(Class)
end
@hectorperez
hectorperez / Chrome shortcuts
Created October 6, 2014 16:29
Chrome shortcuts
y then o Archive and next
e Archive Archive your conversation from any view.
m Mute Archives the conversation, and all future messages skip the Inbox unless sent or cc'd directly to you. Learn more.
# https://support.google.com/mail/answer/6594?hl=en
@hectorperez
hectorperez / reuse a visual mode selection - Vim
Created October 6, 2014 14:00
reuse a visual mode selection (Vim)
gv
# http://superuser.com/questions/220666/how-do-you-reuse-a-visual-mode-selection
@hectorperez
hectorperez / Mongoid create indexes
Created October 3, 2014 16:31
Mongoid create indexes
rake db:mongoid:create_indexes
@hectorperez
hectorperez / combine two images into one - Imagemagick
Created October 2, 2014 14:19
combine two images into one - Imagemagick
convert +append a.png b.png c.png
# http://apple.stackexchange.com/questions/52879/how-to-combine-two-images-into-one-on-a-mac
@hectorperez
hectorperez / parse_json in spec_helper.rb
Created September 30, 2014 13:29
parse_json in spec_helper.rb
# spec_helper.rb
def json
parse_json(response.body)
end
@hectorperez
hectorperez / install mac vim - gvim
Last active July 15, 2024 12:45
install mac vim / gvim
Step 1. Install homebrew from here: http://brew.sh
Step 1.1. Run export PATH=/usr/local/bin:$PATH
Step 2. Run brew update
Step 3. Run brew install vim && brew install macvim
Step 4. Run brew link macvim
# http://stackoverflow.com/questions/21012203/gvim-or-macvim-in-mac-os-x/21012284#21012284
Adv:
- copy & paste between tabs