Send multiple emails to different recipients.
# app/mailers/notify_mailer.rb
class NotifyMailer < ApplicationMailer
>> ActiveRecord::Migrator.current_version # prints current DB version | |
>> ActiveRecord::SchemaMigration.create!(version: '20160606111111') # add DB version |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew tap caskroom/cask | |
brew cask install google-chrome | |
brew cask install skype | |
brew install zsh | |
brew install tmux | |
brew install wget | |
brew install vim --override-system-vi | |
brew install node --with-debug --with-openssl | |
brew install rbenv ruby-build |
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env | |
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced | |
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start | |
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running. | |
# Add the following to your shell init to set up gpg-agent automatically for every shell | |
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then | |
source ~/.gnupg/.gpg-agent-info | |
export GPG_AGENT_INFO | |
else |
source "https://rubygems.org" | |
gem "progressbar" |
from: https://www.johnhawthorn.com/2012/09/vi-escape-delays/ | |
Eliminating delays on ESC in vim and zsh | |
While having a vim discussion on twitter with @_jaredn, I remembered that having a delay in entering normal mode after pressing ESC (switching to normal mode) really frustrates me. This delay exists because many keys (arrows keys, ALT) rely on it as an escape character. Here’s the setup I’ve used for a while for near instantaneous switch into normal mode. | |
vim | |
A simple solution for vim is to :set esckeys. However, this will break any sequences using escape in insert mode. |
#!/usr/bin/env ruby | |
# This prints to the console 256 colors for foreground & background | |
%w(38 48).each do |fgbg| # Foreground/Background | |
(0..256).each do |color| | |
print "\e[#{fgbg};5;#{color}m" + " #{color}".ljust(8, ' ') + "\e[0m" | |
print "\n" if (color + 1) % 10 == 0 | |
end | |
print "\n\n" | |
end |
IO Open Mode
Ruby allows the following open modes:
"r" Read-only, starts at beginning of file (default mode).
"r+" Read-write, starts at beginning of file.
"w" Write-only, truncates existing file
# .railsrc for Rails 3, encoding: utf-8 | |
# see http://rbjl.net/49-railsrc-rails-console-snippets | |
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else | |
# # # | |
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end | |
# # # | |
# loggers |
select name,setting,category,source from pg_settings where category IN( 'Reporting and Logging / Where to Log', 'File Locations' ) order by category,name; |