Skip to content

Instantly share code, notes, and snippets.

["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"
@suryagaddipati
suryagaddipati / about.md
Created August 10, 2011 21:12 — forked from jasonrudolph/about.md
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-^>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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}