Skip to content

Instantly share code, notes, and snippets.

@dentedtriangle
dentedtriangle / gist:2026297
Created March 13, 2012 02:58
Homebrew command-line installation
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
desc "Creates haml files for each of the erb files found under views (skips existing)"
task :erb2haml do from_path
from_path = File.join(File.dirname(__FILE__), '..', '..', 'app', 'views')
Dir["#{from_path}/**/*.erb"].each do |file|
puts file
# for each .erb file in the path, convert it & output to a .haml file
output_file = file.gsub(/\.erb$/, '.haml')
`bundle exec html2haml -ex #{file} #{output_file}` unless File.exist?(output_file)
end
end
@dentedtriangle
dentedtriangle / gist:2100929
Created March 19, 2012 07:31
Remove all .DS_Store files in all directories <= current directory
sudo find . -name ".DS_Store" -depth -exec rm {} \;
@dentedtriangle
dentedtriangle / .gitignore
Created March 19, 2012 07:39
global gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
@dentedtriangle
dentedtriangle / benchmark.rb
Created March 21, 2012 08:46 — forked from matthewrudy/benchmark.rb
Testing the <23 string issue
require 'benchmark'
ITERATIONS = 1000000
Benchmark.bm(10) do |bench|
0.upto(40) do |n|
bench.report("chars: #{n}") do
string = "n"*n
ITERATIONS.times do
string + 'x'
@dentedtriangle
dentedtriangle / setup
Created April 16, 2012 04:58
Setup Mac from Scratch
## Install xcode 4 - App store http://itunes.apple.com/us/app/xcode/id448457090?mt=12)
## iTerm2 - http://www.iterm2.com/
## Homebrew http://mxcl.github.com/homebrew/
ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
Note that Xcode is a pre-req for Homebrew
## Set shell to ZSH and install oh-my-zsh
brew install wget
@dentedtriangle
dentedtriangle / gist:2469508
Created April 23, 2012 08:26
Add Sublime Text 2 to command line in OSX
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl
@dentedtriangle
dentedtriangle / gist:2485961
Created April 25, 2012 03:20
Dynamic Pager on OSX
# turn off
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
# turn back on
sudo launchctl load -wF /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
.arrow_box {
position: relative;
background: #000;
}
.arrow_box:after {
bottom: 100%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
@dentedtriangle
dentedtriangle / ftp_list_files.rb
Created June 22, 2012 08:39
List files of Remote Directory
require 'rubygems'
require 'chilkat'
# Ruby script to list files and sub-directories on an FTP server.
ftp = Chilkat::CkFtp2.new()
success = ftp.UnlockComponent("anything for 30-day trial")
if not success
print "ftp component is locked!"
exit