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
# ~/.bashrc | |
# vim:set ft=sh sw=2 sts=2: | |
source "$HOME/.hashrc" | |
# Store 10,000 history entries | |
export HISTSIZE=10000 | |
# Don't store duplicates | |
export HISTCONTROL=erasedups | |
# Append to history file |
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
#file name and path app/models/user.rb | |
class User | |
attr_encrypted :bank_account_number, key: ENV['salt'] | |
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
#lib/tasks/db.rake | |
namespace :db do | |
desc "Import most recent database dump" | |
task :import_from_prod => :environment do | |
puts 'heroku run pg:backups capture --app sushi-prod' | |
restore_backup 'sushi-prod' | |
end | |
def path_to_heroku | |
['/usr/local/heroku/bin/heroku', '/usr/local/bin/heroku'].detect {|path| File.exists?(path)} |
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 'uri' | |
enc_uri = URI.escape("http://example.com/?a=\111\\115"") | |
p enc_uri | |
# => "http://example.com/?a=%09%0D" | |
p URI.unescape(enc_uri) | |
# => "http://example.com/?a=\t\r" |
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 UsersController < ApplicationController | |
def new | |
@user = User.new | |
end | |
def create | |
@user = User.new(params[:user]) | |
if @user.save | |
flash[:notice] = "You have successfully registered, please log in!" |
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
uEgvHsY8YQDukiNnho1xMzJrjSiDXAhWRFwRunhmLfPIHQGayk |
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
https://openid.stackexchange.com/account/affiliate/complete-registration?affId=4&authCode=ehxvsqtS8uKSe8ZnUv4M09og2K8%3d&callback=http%3a%2f%2fstackoverflow.com%2fusers%2fauthenticate&email=gia%40moiseszaragoza.com&realname=Gia+Furn&token=87dd8d6b-bbb7-4e72-8794-baaa25fdfa55 |
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
You can add the following code to you .bashrc file: | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
PS1="${debian_chroot:+($debian_chroot)}\u@\h:\w\$(parse_git_branch) $ " | |
You can move around these component parts to configure to your tastes, for example to prepend $(parse_git_branch) and not show the user@computer part I used: | |
PS1="\$(parse_git_branch)${debian_chroot:+($debian_chroot)}\w$ " |
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 String | |
def map(arg=nil) | |
if arg | |
[self].map(arg) | |
elsif block_given? | |
[self].map{|i| yield(i)} | |
else | |
[self] | |
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
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi | |
[[ -r $rvm_path/scripts/completion ]] && source $rvm_path/scripts/completion | |
alias bashrc="vim ~/.bashrc.local" | |
alias remove_all_gems='gem list | cut -d" " -f1 | xargs gem uninstall -aIx' | |
cat <<INPUTRC >~/.inputrc | |
set completion-ignore-case On | |
TAB: menu-complete | |
INPUTRC |
NewerOlder