Skip to content

Instantly share code, notes, and snippets.

View divoxx's full-sized avatar

Rodrigo Kochenburger divoxx

  • Doximity
  • San Francisco, CA
View GitHub Profile
@divoxx
divoxx / lame_gems.rb
Last active December 15, 2015 19:59 — forked from maletor/lame_gems.rb
Then anyone could have group "[email protected]" do end
groups = Rails.groups(assets: %w(development test))
unless Rails.env.production?
user = `cd "#{Rails.root}" && git config user.email`.chomp
groups << user unless user.blank?
end
Bundler.require(*groups)
@divoxx
divoxx / gist:2406319
Created April 17, 2012 14:29 — forked from arbylee/gist:2396008
RomanNumerals
class RomanNumeral
VALUE_MAPPER = [['M', 1000], ['D', 500], ['L', 50], ['X', 10], ['IX', 9], ['V', 5], ['IV', 4], ['I', 1]]
def roman num
output = ''
while num > 0
VALUE_MAPPER.each do |letter, letter_value|
num_of_letters = (num / letter_value)
@divoxx
divoxx / gist:594580
Created September 23, 2010 23:11 — forked from mmurray/gist:594579
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :token_authenticatable,
:oauthable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me, :username, :has_username, :is_admin, :profile
# Between those alternatives I'd go with this one.
#
# Ruby has open classes, there is nothing wrong about embracing them. Even Rails that used to
# create modules and mix them into the classes has decided to change it on rails3 and simply
# open the classes and add the methods.
#
# It's simple, and it works. Of course you shouldn't be adding stuff that are specific to
# your application's business logic.
class Fixnum
def to_bit_array