Skip to content

Instantly share code, notes, and snippets.

View benzittlau's full-sized avatar

Ben Zittlau benzittlau

View GitHub Profile
@benzittlau
benzittlau / tmux.conf
Created November 9, 2012 03:30
Template tmux.conf file
# Act like Vim
set-window-option -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Look good
set-option -g default-terminal "screen-256color"
@benzittlau
benzittlau / send-template
Created October 13, 2012 19:16
Working send template call for mandrill
m.messages 'send-template', {:template_name => "Folder Shared", :template_content => [{:name => "sharelink", :content => "<a href='www.google.com'>test link</a>"},{:name => "monkeyrewards", :content => "<a href='www.google.com'>test link</a>"}], :message => {:subject => "Folder Shared!", :from_email => "[email protected]", :to => [{:email => "[email protected]", :name => "Ben Zittlau"}]}}
@benzittlau
benzittlau / game_of_life.rb
Created September 24, 2012 16:06
Game of life implementation in ruby
class World
attr_accessor :cells
NEXT_STATE = [:dead, :alive, :alive, :dead, :dead, :dead, :dead, :dead]
def initialize(cells)
@cells = cells
end
def add_newly_born_cells
@benzittlau
benzittlau / gist:3130243
Created July 17, 2012 15:55
Combine Find with Tar
sudo find . -mtime -30 ! -type d -print | xargs tar -cvf ~/archive.tar
@benzittlau
benzittlau / gist:1364764
Created November 14, 2011 18:56
Push a specific git commit to a remote repo
Push the commit with the given SHA to origin:develop
git push origin 3733b4360f280f084c1d719e7cf4d277c7934621:develop
@benzittlau
benzittlau / reset_hard_origin_master
Created October 13, 2011 01:48
Reset a local branch to exactly match a remote branch
macbook:al Ben$ git reset --hard origin/master
@benzittlau
benzittlau / blur.html
Created September 23, 2011 17:39
Ben's amazing bluring script
<html>
<head>
<title> Ben's amazing bluring script </title>
</head>
<h1> Ben's amazing bluring script </h1>
<button id="reset">Reset</button>
<button id="blur">Blur</button>
<span id="paint_white" class="selected">Paint White</span>
<span id="paint_black">Paint Black</span>
<span id="paint_toggle">Paint Toggle</span>
@benzittlau
benzittlau / gist:1230582
Created September 20, 2011 22:15
Various Delayed Job snippets
# List delayed jobs
ruby-1.9.2-p180 :002 > Delayed::Job.all.to_a
# Generate delayed job mongoid indexes
rails runner 'Delayed::Backend::Mongoid::Job.create_indexes'
# Work off the delayed job queue
Delayed::Worker.new.work_off
# Disabled delayed jobs during test
@benzittlau
benzittlau / gist:1230560
Created September 20, 2011 22:09
Github file finder
Press "t" to active the file finder. It's amazing
@benzittlau
benzittlau / gist:1227704
Created September 19, 2011 21:45
Rails config settings for sending mail through gmail
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => 587,
:domain => "whatever.com",
:authentication => :plain,
:user_name => "[email protected]",
:password => "xxxxxxxxx",
:openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE
}