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/sh | |
# Script for installing optware on DD-WRT | |
# Written by frater | |
# | |
export PATH=/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin | |
SCRIPTVER="Fri Apr 22 17:08:38 CEST 2011" | |
export SITES='http://ipkg.nslu2-linux.org http://ftp-osl.osuosl.org/pub/nslu2' | |
export dom=wd.mirmana.com |
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
function rmb { | |
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
if [ "$current_branch" != "master" ]; then | |
echo "WARNING: You are on branch $current_branch, NOT master." | |
fi | |
echo "Fetching merged branches..." | |
git remote prune origin | |
remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$") | |
local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$") | |
if [ -z "$remote_branches" ] && [ -z "$local_branches" ]; then |
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 Tester | |
def Tester.hello | |
print 'hello' | |
end | |
extend Module.new { | |
def world | |
print 'world' | |
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
I18n.extend Module.new { | |
def translate(*args) | |
print args.to_yaml | |
super | |
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
#app/models/parent.rb | |
class Parent < ActiveRecord::Base | |
accepts_nested_attributes_for :children | |
validate :children_are_less_than_two | |
private | |
def children_are_less_than_two | |
errors.add(:base, | |
"shouldn't have more than two children" | |
) if children.count > 2 |
NewerOlder