I hereby claim:
- I am orlando on github.
- I am orlando (https://keybase.io/orlando) on keybase.
- I have a public key whose fingerprint is D83C 56F0 986E 294C A631 0473 A692 3BDA F7BF BD00
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# config/database.rb | |
config_file = Padrino.root("config", "mongoid.yml") | |
if File.exists?(config_file) | |
settings = YAML.load(ERB.new(File.read(config_file)).result)[Padrino.env.to_s] | |
::Mongoid.from_hash(settings) if settings.present? | |
end |
es: | |
errors: | |
messages: | |
expired: "has expired, please request a new one" | |
not_found: "not found" | |
already_confirmed: "was already confirmed, please try signing in" | |
not_locked: "was not locked" | |
not_saved: | |
one: "1 error prohibited this %{resource} from being saved:" | |
other: "%{count} errors prohibited this %{resource} from being saved:" |
module Jekyll | |
require 'haml' | |
class HamlConverter < Converter | |
safe true | |
priority :low | |
def matches(ext) | |
ext =~ /haml/i | |
end |
#!/usr/bin/ruby | |
require 'rss' | |
p 'Downloading rss index' | |
rss_string = open('http://feeds.feedburner.com/railscasts').read | |
rss = RSS::Parser.parse(rss_string, false) | |
videos_urls = rss.items.map { |it| it.enclosure.url }.reverse | |
videos_filenames = videos_urls.map {|url| url.split('/').last } |
# this give us activerecord like commands for events, also extend the object with the respective methods | |
# | |
# example | |
# | |
# @cachedevent.reservations return all reservations in a hash | |
# {"15"=>#<BSON::OrderedHash:0x-2581ca5a {values}} | |
# | |
# also extends the object with | |
# | |
# @cachedevent.reservations.extend(ReportAgregator::Reservations) |
class Date | |
def self.to_mongo(value) | |
if value.nil? || value == '' | |
nil | |
else | |
date = value.is_a?(::Date) || value.is_a?(::Time) ? value : ::Date.parse(value.to_s) | |
::Time.utc(date.year, date.month, date.day, date.try(:hour), date.try(:min), date.try(:sec)) | |
end | |
rescue | |
nil |
if [[ -n "$PS1" ]]; then | |
PS1='\[\033[01;30m\][ \[\033[01;31m\]\u \[\033[01;30m\]]\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
eval "`dircolors -b`" | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
fi | |
xhost +LOCAL: |
# natcmp.rb | |
# | |
# Natural order comparison of two strings | |
# e.g. "my_prog_v1.1.0" < "my_prog_v1.2.0" < "my_prog_v1.10.0" | |
# which does not follow alphabetically | |
# | |
# Based on Martin Pool's "Natural Order String Comparison" originally written in C | |
# http://sourcefrog.net/projects/natsort/ | |
# | |
# This implementation is Copyright (C) 2003 by Alan Davies |
$("li.month").click(function(e){ | |
e.preventDefault(); | |
var selected_month = $(this).closest('li').index(); | |
$("#slider-range").slider("values",[Math.abs(moment([moment().year()]).diff(moment([moment().year()]).month(selected_month-1),'month')),Math.abs(moment([moment().year()]).diff(moment([moment().year()]).month(selected_month),'days'))]); | |
}); |