Skip to content

Instantly share code, notes, and snippets.

@Lytol
Lytol / dev
Created December 3, 2014 01:52
#!/bin/bash
SESSION=`basename $PWD`
tmux new-session -d -s $SESSION -n 'Shell'
tmux split-window -h
if [[ -e Procfile ]]; then
tmux new-window -t $SESSION:1 -n 'Foreman'
# Replace the Gemfile wholesale, it's just easier
#
remove_file "Gemfile"
create_file "Gemfile", <<-EOF
source 'https://rubygems.org'
ruby '2.1.5'
gem 'rails', '4.2.0'
gem 'pg'
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●%f'
zstyle ':vcs_info:*' unstagedstr '%F{red}●%f'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' formats '[%F{027}%b%f%c%u] '
zstyle ':vcs_info:*' enable git
theme_precmd () {
if [[ -z $(git ls-files --other --exclude-standard 2> /dev/null) ]] {
zstyle ':vcs_info:*' formats '[%F{027}%b%f%c%u] '
@Lytol
Lytol / gist:1065962
Created July 5, 2011 21:14
Body tag helper that sets class and id based on controller/action
def body_tag(&blk)
controller_name = controller.class.to_s.underscore.gsub(/_controller$/, '').gsub(/\//,'_')
action_name = controller.action_name.underscore.gsub(/_/,'-')
content_tag(:body, :id => "#{controller_name}-#{action_name}", :class => controller_name, &blk)
end
@Lytol
Lytol / gist:5015688
Last active December 14, 2015 02:39
Beginner's Guide to Vim
@Lytol
Lytol / ultemplate.rb
Created September 23, 2010 07:02
Rails 3 Application Template
# Rails application template for Rails 3 + Postgres + Git + haml + JQuery + Rspec + Cucumber + Capybara + FactoryGirl
# by Brian Smith <bsmith@swig505.com>
# Create a default README
file "README.md", <<-EOF
#{app_name}
#{"=" * app_name.length}
TODO: description