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 Time | |
def round_nearest(sec=1) | |
down = self - (self.to_i % sec) | |
up = down + sec | |
difference_down = self - down | |
difference_up = up - self | |
if (difference_down < difference_up) | |
return down |
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
from pyquery import PyQuery as pq | |
xml_in = """ | |
<foo> | |
<elementone>one</elementone> | |
<elementTwo>two</elementTwo> | |
</foo> | |
""" | |
d = pq(xml_in) |
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
Bundler 1.5.3 | |
Ruby 2.1.1 (2014-02-24 patchlevel 76) [x86_64-darwin12.0] | |
Rubygems 2.2.2 | |
GEM_HOME /Users/jlamberg/.rbenv/versions/2.1.1/gemsets/foobar-webapp | |
GEM_PATH /Users/jlamberg/.rbenv/versions/2.1.1/gemsets/foobar-webapp:/Users/jlamberg/.rbenv/versions/2.1.1/gemsets/global:/Users/jlamberg/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0 | |
Gemfile | |
source 'https://rubygems.org' | |
ruby '2.1.1' |