Skip to content

Instantly share code, notes, and snippets.

View phirefly's full-sized avatar

Raphael (Raphy) Villas phirefly

View GitHub Profile
class ModelName
include MongoMapper::Document
key :key, String
timestamps!
# Validations :::::::::::::::::::::::::::::::::::::::::::::::::::::
# validates_presence_of :attribute
# config/initializers/mongodb.rb
db_config = YAML::load(File.read(File.join(Rails.root, "/config/database.yml")))
if db_config[Rails.env] &&
db_config[Rails.env]['adapter'] == 'mongodb'
mongo = db_config[Rails.env]
MongoMapper.connection = Mongo::Connection.new(mongo['hostname'])
MongoMapper.database = mongo['database']
end
# /lib/tasks/mongo.rake
namespace :db do
namespace :test do
task :prepare do
# Stub out for MongoDB
end
end
end
@phirefly
phirefly / gist:991979
Created May 25, 2011 21:04
selenium error
Exception `LoadError' at /Users/rv/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:1231 - no such file to load -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/rv/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems.rb:1240 - no such file to load -- rubygems/defaults/ruby
Exception `LoadError' at /Users/rv/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- selenium-webdriver
Exception `LoadError' at /Users/rv/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29 - no such file to load -- Win32API
Exception `LoadError' at /Users/rv/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:35 - no such file to load -- Win32API
Exception `NoMethodError' at /Users/rv/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/1.8/rational.rb:82 - undefined method `gcd' for Rational(1, 2):Rational
Exception `LoadError' at /Users/rv/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/
@phirefly
phirefly / LAZY2Bd
Last active December 15, 2015 21:18
Customized sublime theme based off of LAZY
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Raphael Villas</string>
<key>name</key>
<string>LAZY2Bd</string>
<key>settings</key>
<array>
@phirefly
phirefly / gist:5409266
Created April 18, 2013 01:38
Sublime: User prefs
{
"color_scheme": "Packages/Color Scheme - Default/LAZY2Bd.tmTheme",
"font_face": "Anonymous Pro",
"font_size": 16.0,
"highlight_line": true,
"ignored_packages":
[
],
"line_padding_top": 3,
"tab_size": 2,
@phirefly
phirefly / SolarizedLight2Bd
Last active December 18, 2015 09:39
Customized sublime theme based off of Solarized (light)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Solarized (light)</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@phirefly
phirefly / bh_core.sublime-settings
Created June 13, 2013 01:02
Sublime: Bracket Highlighter user prefs
{
//Debug logging
"debug_enable": false,
// Path to find icons at
"icon_path": "BracketHighlighter/icons",
// When only either the left or right bracket can be found
// this defines if the unmatched bracket should be shown.
"show_unmatched" : true,
@phirefly
phirefly / button style
Created June 20, 2013 03:16
Flat css button style
.button {
display: inline-block;
padding: 4px 10px;
margin-bottom: 0;
font-size: 12px;
line-height: 18px;
color: #666666;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
@phirefly
phirefly / bash prompt: color config
Created June 20, 2013 15:11
bash prompt goodness
# e Colors from http://wiki.archlinux.org/index.php/Color_Bash_Prompt
# misc
NO_COLOR='\e[0m' #disable any colors
# regular colors
BLACK='\e[0;30m'
RED='\e[0;31m'
GREEN='\e[0;32m'
YELLOW='\e[0;33m'
BLUE='\e[0;34m'
MAGENTA='\e[0;35m'