Skip to content

Instantly share code, notes, and snippets.

Working from home

Gustavo Matias gumatias

Working from home
View GitHub Profile
gumatias /
Last active Apr 19, 2018
[Find and replace strings in directory] bash shortcut to find and replace a string across all files under a specified dir #Utilities
find . -type f -name '*' -exec sed -i '' s#find#replace#g {} +
View gist:9919357

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by
  • pry -r ./config/environment.rb - load your rails into a pry session


ryanb / abilities.rb
Created Sep 15, 2012
How you can break up large Ability class in CanCan
View abilities.rb
module Abilities
def self.ability_for(user)
if user.admin?
else user
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
them0nk / rspec_rails_cheetsheet.rb
Created Mar 23, 2012
Rspec Rails cheatsheet (include capybara matchers)
View rspec_rails_cheetsheet.rb
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
response.should render_template(:index)
response.should redirect_to(movies_path)
View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:


start new with session name:

View gist:1637874
# ~/.gitconfig from @boblet
# initially based on
excludesfile = /Users/oli/.gitignore
legacyheaders = false # >git 1.5
quotepath = false
pager = less -r
# if ↑ doesn’t work, try: pager = less -+$LESS -FRX
3dd13 / generate_ssh_keys.rb
Created Jan 20, 2011
chef recipe to generate ssh key for a user
View generate_ssh_keys.rb
define :generate_ssh_keys, :user_account => nil do
username = params[:user_account]
raise ":user_account should be provided." if username.nil?
Chef::Log.debug("generate ssh skys for #{username}.")
execute "generate ssh skys for #{username}." do
user username
creates "/home/#{username}/.ssh/"