This file contains hidden or 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
| A list of things from Michael Feather's "The Self-Educating Craftsman" talk from Software Craftsmanship North America (courtesy of Jim Weirich). I'm still hoping Michael will put up his slides though... | |
| Cheers! | |
| * big-O notation | |
| * covariance / contravariance | |
| * types | |
| * objects are closures | |
| * State machines | |
| * regular expressions & automata |
This file contains hidden or 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
| # usage: gh-archive ryanbriones/git-pair | |
| function gh-archive() { | |
| name=${1%/*}; | |
| project=${1##*/}; | |
| mkdir "$name-$project"; | |
| wget "http://github.com/$name/$project/tarball/master" -O- | tar zxvC "$name-$project" --strip 1; | |
| } |
This file contains hidden or 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
| # how do I test this elegantly? | |
| class Request < ActiveRecord::Base | |
| named_scope :active, :conditions => {:status => 'active'} | |
| named_scope :incomplete, :conditions => {:completed_at => nil} | |
| named_scope :deliquent, lambda { {:conditions => 10.days.ago} } | |
| def self.do_stuff_with_incomplete_requests | |
| incomplete_requests = Request.active.incomplete.deliquent(:include => {:user}) | |
| incomplete_requests.each do |request| |
This file contains hidden or 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
| SICP 1.1 | |
| Fork me. Solve me. | |
| ==== | |
| ;; I wasn't completely clear on the point of this exercise | |
| ;; so I tried doing them in my head before running them in the repl | |
| 10 ;; => 10 | |
| (+ 5 3 4) ;; => 12 | |
| (- 9 1) ;; => 8 |
This file contains hidden or 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
| SICP 1.2 | |
| Fork me. Solve me. | |
| ==== | |
| (/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 4 5))))) | |
| (* 3 (- 6 2) (- 2 7))) | |
| ;; => -37/150 |
This file contains hidden or 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
| SICP 1.3 | |
| Fork me. Solve me. | |
| ==== | |
| (define (square x) (* x x)) | |
| (define (sum-of-squares a b) (+ (square a) (square b))) | |
| (define (sum-two-largest-squares a b c) | |
| (cond ((and (< a b) (< a c)) |
This file contains hidden or 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
| ;; SICP 1.4 | |
| ;; Fork me. Solve me. | |
| ;; ==== | |
| (define (a-plus-abs-b a b) | |
| ((if (> b 0) + -) a b)) | |
| (a-plus-abs-b 1 2) | |
| ;; ((if (> 2 0) + -) 1 2) | |
| ;; (+ 1 2) |
This file contains hidden or 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
| ;; SICP 1.5 | |
| ;; Given: | |
| ;; | |
| ;; (define (p) (p)) | |
| ;; | |
| ;; (define (test x y) | |
| ;; (if (= x 0) | |
| ;; 0 | |
| ;; y)) |
This file contains hidden or 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
| ;; SICP 1.6 | |
| ;; Fork me. Solve me. | |
| ;; if is a special form that only evaluates the arguments after the predicate has been evaluated. | |
| ;; since new-if evaluates it's arguments immediately, the program is sent into an infinite loop | |
| ;; evaluating sqrt-iter with an improved guess |
This file contains hidden or 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
| ;; SICP 1.8 | |
| ;; Fork me. Solve me. | |
| (define (cube x) (* x x x)) | |
| (define (improve y x) | |
| (/ (+ (/ x (* y y)) (* 2 y)) 3)) | |
| (define (good-enough? guess x) | |
| (< (abs (- (cube guess) x)) 0.001)) |