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
#Add this to your .bashrc file in Ubuntu. Make sure you have the right libs | |
alias not='notify-send "Build done in DIR: $PWD"' | |
#bd a function to run an ant target AND be notified about it. | |
function bd { | |
if [ -z "$1" ]; then | |
ant publish; | |
notify-send "Build done for target (publish) in DIR: $PWD" | |
else |
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
#ActiveRecord scoped query left outer join users to members | |
scope :not_in_group, lambda { |group| | |
join_clause = User.send(:sanitize_sql_array, | |
["LEFT OUTER JOIN memberships ON memberships.user_id = users.id WHERE memberships.group_id is not ?", group ]) | |
User.select("distinct(users.id), users.*").joins(join_clause) | |
} |
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
#git vcprompt settings -> https://github.com/xvzf/vcprompt | |
alias vcp="vcprompt --format '(%b:%h)'" | |
export PS1='\u@\h:\w $(vcp)\$' |
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
package foo; | |
import java.util.Set; | |
import javax.validation.ConstraintViolation; | |
import javax.validation.Validation; | |
import javax.validation.Validator; | |
import javax.validation.ValidatorFactory; | |
import org.hibernate.validator.constraints.ScriptAssert; |
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
suits = %w{ C D H S } | |
ranks = [ *'2'..'10', *%w{ J Q K A } ] | |
deck = suits | |
.product(ranks) | |
.map(&:join) | |
hands = deck | |
.shuffle | |
.each_slice(13) | |
puts hands.first.join(", ") |
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
tweaked my copy of showoff to work with ruby 1.9 | |
see changes here | |
http://github.com/schacon/showoff/commit/e01d4ef29b204e5674bacff208c3d9ac63bae338 | |
not sure why the gem i d/l'ed didn't have this change. | |
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
1st public gist..this is pretty cool |
NewerOlder