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
#Sample 1 | |
puts "#{$@.first}: #{$!.message} (#{$!.class})", $@.drop(1).map{|s| "\t#{s}"} | |
#Sample 2 | |
puts "#{e.backtrace.first}: #{e.message} (#{e.class})", e.backtrace.drop(1).map{|s| "\t#{s}"} |
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 Dog | |
has_many :tags | |
belongs_to :person | |
end | |
Class Person | |
has_many :dogs | |
end | |
d = Dog.new |
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 | |
export JAVA_OPTS="-Xmx2048m -XX:ReservedCodeCacheSize=256m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -XX:NewRatio=3 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSClassUnloadingEnabled -Dfile.encoding=UTF-8 -XX:+TieredCompilation -XX:TieredStopAtLevel=1" | |
export JRUBY_OPTS="--1.9 -J-noverify -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1" | |
torquebox run -b 0.0.0.0 |
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
(define (memoize f) | |
(define ht (make-hash)) | |
(define (f-mem . args) | |
(if (hash-has-key? ht args) | |
(hash-ref ht args) | |
(begin | |
(hash-set! ht args (apply f args)) | |
(hash-ref ht args)))) | |
f-mem) |
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
(use 'clojure.java.io) | |
(let [pred (every-pred | |
#(.isDirectory %) | |
#(not (.startsWith (.getName %) ".")) | |
#(not (some (partial = (.getName %)) ["Exclude Name 0" "Exclude Name 1" "Exclude Name 2"]))) | |
dest "/Path/to/Destination" | |
src "/Path/to/Source" ] | |
(doseq [f (filter pred (-> src file .listFiles seq))] | |
(.renameTo f (file dest (.getName f))) )) |
NewerOlder