This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ToHaml | |
def initialize(path) | |
@path = path | |
end | |
def convert! | |
Dir["#{@path}/**/*.erb"].each do |file| | |
`html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}` | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Jquery and Rails powered default application.js | |
Easy Ajax replacement for remote_functions and ajax_form based on class name | |
All actions will reply to the .js format | |
Unostrusive, will only works if Javascript enabled, if not, respond to an HTML as a normal link | |
respond_to do |format| | |
format.html | |
format.js {render :layout => false} | |
end | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Rails screen session | |
# Usage: screen -c ~/.rails.screen (add alias) | |
source ~/.screenrc | |
screen -t dev 0 | |
split | |
resize 40 | |
focus down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Autotest::GnomeNotify | |
# Time notification will be displayed before disappearing automatically | |
EXPIRATION_IN_SECONDS = 2 | |
ERROR_STOCK_ICON = "gtk-dialog-error" | |
SUCCESS_STOCK_ICON = "gtk-dialog-info" | |
# Convenience method to send an error notification message | |
# | |
# [stock_icon] Stock icon name of icon to display |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run me with: | |
# | |
# $ watchr specs.watchr | |
# -------------------------------------------------- | |
# Watchr Rules | |
# -------------------------------------------------- | |
#START:SPECS | |
watch('^spec/(.*)_spec\.rb') { |m| run_test_matching(m[1]) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
class Array | |
def uniq_by | |
seen = Set.new | |
select{ |x| seen.add?( yield( x ) ) } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Numeric | |
KILOBYTE = 1024 | |
MEGABYTE = KILOBYTE * 1024 | |
GIGABYTE = MEGABYTE * 1024 | |
def bytes | |
self | |
end | |
alias :byte :bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires root permissions in /usr/bin/ | |
star = String.new | |
8.times { star += "*" } | |
Star = "\n#{star * 3}\n" | |
def newblock string | |
puts "\n#{Star}#{string}#{Star}\n" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author : why the lucky stiff | |
# include in any project in which metaprogramming is needed | |
class Object | |
# The hidden singleton lurks behind everyone | |
def metaclass; class << self; self; end; end | |
# The equivalent of class_eval for singleton classes. | |
# Evaluates the given block in | |
# the context of the receiver’s singleton class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile | |
echo 'eval "$(rbenv init -)"' >> ~/.zshrc | |
source ~/.bash_profile | |
source ~/.zshrc |
OlderNewer