Skip to content

Instantly share code, notes, and snippets.

View gist:433925
cpm@juno ~/tmp: cat <<EOF | perl -P
#define MACRO sub { say "Something Interesting" }
use feature "say";
MACRO->();
EOF
Something Interesting
View .zshrc
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -e
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/home/cpm/.zshrc'
View pretty_ps1_with_git.sh
# I am tired of losing this.
# Pretty PS1, and shows git branch.
export PS1="\[\033[0;38m\][ \[\033[0;37m\]\u\[\033[0;31m\] \h \[\033[0;33m\]\w\[\033[0;32m\]\$(__git_ps1 ":%s")\[\033[0;38m\] ] \[\033[0m\]"
View My Usual vimrc.vim
" My usual .vimrc. Tired of losing this.
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
set bg=dark
filetype plugin on
filetype indent on
@cpm
cpm / simple_form_table.rb
Created Jul 30, 2014
SimpleForm table wrapper
View simple_form_table.rb
# place in RAILS_ROOT/config/initializers/
# This initializer will give a simple table-based form layout using SimpleForm
# There are two wrappers provided.
# simple_form_for(@obj, wrapper: "table") will make <TR><TH>label</TH><TD>input, help, and error</TD></TR>
# simple_form_for(@obj, wrapper: "table_just_cells") will skip the TR tags.
SimpleForm.setup do |config|
# wrap all the common wrapper initialization in a lambda
# I don't think you can just do `b.use :table_just_cells` inside :table, or I would have. this works well enough.