This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
["second", "first"].member?(o.name) |
first_second = Order.find(:all , :conditions => {:name => ["second", "first"]}) |
has_many :orders, :autosave => true, :dependent => :destroy | |
validates_presence_of :number, :message => "Number is blank" |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
nmap <silent> cp "_cw<C-R>"<Esc> | |
nmap <silent> jj <c-w><c-w>W | |
nnoremap <leader><leader> <c-^> |
Dir.glob(File.join( "**",'*')).inject({}) {|counts, file| counts[file] = `git log --pretty=format:"%h %ad | %s%d [%an]" --date=short --name-only #{file}`.count('|'); counts } |
(ns clonic.scanner | |
(:use [clojure.contrib.string :only (split lower-case replace-re)] | |
[clonic.normalizer :only (normalize)] | |
)) | |
(def components { | |
:season {#"^springs?$" :spring | |
#"^summers?$" :summer | |
#"^(autumn)|(fall)s?$" :autumn | |
#"^winters?$" :winter} |
(ns clonic.normalizer | |
(:use [clojure.contrib.string :only (split lower-case replace-re)] | |
[clojure.contrib.str-utils2 :only (replace)] )) | |
(defn pattern-replacer ( [x] x) | |
([x y] | |
(replace x (first y) (second y)))) | |
(defn pattern-formatter ( [x] x) | |
([x y] |
; answers to latest question | |
@(:answers (question 1)) | |
; first answer to latest question | |
(first @(:answers (question 2))) | |
;{:question_id 3542317, :score 0, :down_vote_count 0, :creation_date 1282501642, :answer_id 3542746, :last_edit_date 1282504223, :owner {:user_id ;270929, :user_type "registered", :display_name "desco", :reputation 1828, :email_hash "c823ecdede70a4efe7615ba9931412cf"}, :title "F# - Recursive ;Read XML Data", :up_vote_count 0, :answer_comments_url "/answers/3542746/comments", :last_activity_date 1282504223, :view_count 29, ;:community_owned false, :accepted false} | |