Skip to content

Instantly share code, notes, and snippets.

View bernardobarreto's full-sized avatar
🚴‍♂️

Bernardo bernardobarreto

🚴‍♂️
  • 22:24 (UTC -03:00)
View GitHub Profile
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@sporkd
sporkd / mongoid_nested_embeds_many.rb
Created January 23, 2011 08:51
Explains how mongoid embeds_many is breaking when nesting more than 1 level deep
class Author
include Mongoid::Document
field :name, :type => String
embeds_many :posts
end
class Post
include Mongoid::Document
field :title, :type => String
embedded_in :author
@erichurst
erichurst / database.yml.example mysql2
Created May 9, 2011 02:58
Rails 3 database.yml examples
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@ryanb
ryanb / railscasts_episodes.txt
Created June 29, 2011 21:41
List of all RailsCasts episode names with numbers
001-caching-with-instance-variables
002-dynamic-find-by-methods
003-find-through-association
004-move-find-into-model
005-using-with-scope
006-shortcut-blocks-with-symbol-to-proc
007-all-about-layouts
008-layouts-and-content-for
009-filtering-sensitive-logs
010-refactoring-user-name-part-1
@cblunt
cblunt / Gemfile
Created October 21, 2011 08:55
Configure Carrierwave for Amazon S3 Storage and Heroku
# ...
gem 'carrierwave'
gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL
@rodrigomanhaes
rodrigomanhaes / bola.rb
Created November 30, 2011 03:39
Soluções em Ruby da Lista 1 de exercícios de Programação Orientada a Objetos
class Bola
def initialize(cor)
@cor = cor
end
attr_accessor :cor
end
@canton7
canton7 / Sample DataMapper model.rb
Last active September 10, 2018 03:16
Sinatra Auth in a Box
# From bcrypt-ruby gem
require 'bcrypt'
class User
include DataMapper::Resource
attr_accessor :password, :password_confirmation
property :id, Serial
property :username, String, :required => true, :length => (2..32), :unique => true
property :password_hash, String, :length => 60
@gabriellima
gabriellima / gist:1828218
Created February 14, 2012 17:14
custom apt-fast (based on 0.02 by Matt Parnell)
# !/bin/sh
# CUSTOM version by Gabriel Lima (http://www.github.com/gabriellima) (@glima5)
# * Check portuguese (pt_BR) apt-get output
# * support '--force-yes' param to pass through user response
# * pass '-n10' to axel, to use 10 connections instead of default number
# * show packages installed or upgraded in the end of command execution
# apt-fast v0.02 by Matt Parnell http://www.mattparnell.com, this thing is fully open-source
# if you do anything cool with it, let me know so I can publish or host it for you
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>