Skip to content

Instantly share code, notes, and snippets.

@dentedtriangle
dentedtriangle / list_files.rb
Created June 25, 2012 10:14
list files in directory
require 'find'
files = {}
Find.find('.') do |f|
if(f != '.' && f != '..' && File.file?(f) && !f.include?('git'))
size = File.size(f)
if(size > 0)
files[f] = size
end
end
@dentedtriangle
dentedtriangle / _messages.html.haml
Created July 4, 2012 10:27
Ruby Flash Messages
- flash.each do |name, msg|
%div{:class => "alert alert-#{name == :notice ? "success" : "error"}"}
%a.close{"data-dismiss" => "alert"} ×
= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String)
@dentedtriangle
dentedtriangle / gist:3095752
Created July 12, 2012 04:33 — forked from jasoncodes/gist:1223731
Installing Ruby 1.9.3 with rbenv
brew install rbenv
brew install ruby-build
brew install rbenv-vars
brew install readline
brew install ctags
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
exec $SHELL -i # reload the shell
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p194
rbenv global 1.9.3-p194
gem install bundler rbenv-rehash git-up hitch gem-browse gem-ctags cheat awesome_print pry