Skip to content

Instantly share code, notes, and snippets.

has_many :parameters_store, :as => :parameterable do
def to_hash
Hash[*target.map{|p| [p.key, p.vaue]}.flatten]
end
def from_hash(hash)
end
end
#!/usr/bin/env ruby
## git-rank-contributors: a simple script to trace through the logs and
## rank contributors by the total size of the diffs they're responsible for.
## A change counts twice as much as a plain addition or deletion.
##
## Output may or may not be suitable for inclusion in a CREDITS file.
## Probably not without some editing, because people often commit from more
## than one address.
##
function s:GetTestCmd()
let test_patterns = {}
let test_patterns['_test.rb$'] = "ruby %p"
let test_patterns['_spec.rb$'] = "spec -f specdoc %p"
for [pattern, cmd] in items(test_patterns)
if @% =~ pattern
return cmd
endif
endfor
noremap <unique> <script> <Plug>RubyFileRun <SID>RunFile
noremap <SID>RunFile :call <SID>RunTests()<CR>
if !hasmapto('<Plug>RubyFileRun')
map <unique> <silent> <Leader>t <Plug>RubyFileRun
endif
augroup RUBY
autocmd!
autocmd BufNewFile,BufRead *_test.rb compiler rubyunit
augroup END
| Ebmaj7 Bb-7 | C7 | F-7 Ab-7 | B7 | B-7 | Eb7alt
E---------------|----------|--------------|--------|--------|--------------------
B--6-----6------|--6-------|--8-----7-----|--7--7--|--7--7--|--7-----------------
G--7-----6------|--6-------|--8-----4-----|--8--8--|--7--7--|--6-----------------
D--5-----6------|--8-------|--6-8-6-6-----|--7--7--|--7--7--|--5-----------------
A--6------------|----5-6-7-|--8-----------|--------|--------|--6-----------------
E--------6---7--|--8-------|--------4-5-6-|--7--7--|--7--7--|--------------------
/* =Reset */
* { margin: 0; padding: 0; }
body, html { height: 100%; }
body { font: 62.5%/1.5 Verdana, sans-serif; }
ul, ol { list-style: none; }
a { outline: none; }
a img { border:none; }
h1, h2, h3, h4, h5 { font-weight: normal;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
##
def set_node_reported_at
puts '---'
puts report.time.inspect
node.update_attribute(:reported_at, report.time)
puts node.reported_at.inspect # <- wtf?
puts '---'
end
# ---
it "updates the node's reported_at timestamp" do
node = Node.generate(:name => @report_data.host)
Report.create(:report => @report_yaml)
node.reload
time_delta = (node.reported_at - @report_data.time).abs
(time_delta < 1).should be_true
end
'Report on creation updates the node's reported_at timestamp' FAILED
expected: Fri, 20 Nov 2009 01:08:50 UTC +00:00,
got: Fri, 20 Nov 2009 01:08:50 UTC +00:00 (using ==)