Skip to content

Instantly share code, notes, and snippets.

View rafaelfranca's full-sized avatar
🚆
Focused on Rails

Rafael Mendonça França rafaelfranca

🚆
Focused on Rails
View GitHub Profile
@mislav
mislav / backfill-releases.sh
Created February 5, 2014 17:37
Script to migrate releases from CHANGELOG.md to GitHub Releases
#!/bin/bash
# Usage: OAUTH_TOKEN="..." backfill-releases CHANGELOG.md [<project-title>]
set -e
log="${1?}"
project_name="${2}"
repo="$(git config remote.origin.url | grep -oE 'github\.com[/:][^/]+/[^/]+' | sed 's/\.git$//' | cut -d/ -f2-3)"
[ -n "${project_name}" ] || project_name="${repo#*/}"
require "spec/acceptance/acceptance_helper"
feature "Login", %q{
In order to access my account
As an user
I want to be able to log in
} do
let :user do
Factory :user
@dcrec1
dcrec1 / matchers.rb
Created September 17, 2010 22:38
Rails3 RSpec matchers
def should_be_delivered_on_creation_with(clazz)
context "on creation" do
it "should be send on an email" do
mailer = mock(clazz)
clazz.should_receive(subject.class.to_s.underscore).with(an_instance_of(subject.class)).and_return(mailer)
mailer.should_receive :deliver
Factory subject.class.to_s.underscore
end
end
end
require 'spec_helper'
require 'steak'
require 'capybara/rails'
require 'database_cleaner'
require 'akephalos'
DatabaseCleaner.strategy = :truncation
Capybara.default_selector = :css
class ActiveRecord::Base
@timblair
timblair / caveatPatchor.js
Created February 15, 2011 10:27 — forked from protocool/caveatPatchor.js
Sample caveatPatchor.js file for use in Propane 1.1.2 and above: pulls avatars from Gravatar
/*
As of version 1.1.2, Propane will load and execute the contents of
~Library/Application Support/Propane/unsupported/caveatPatchor.js
immediately following the execution of its own enhancer.js file.
You can use this mechanism to add your own customizations to Campfire
in Propane.
Below you'll find two customization examples.
function! RunSpec()
if executable('./bin/spec')
:!./bin/spec %
elseif executable('./bin/rspec')
:!./bin/rspec %
elseif executable('bundle')
:!bundle exec ruby -I'lib:test' %
endif
endfunction
@lucasmazza
lucasmazza / documentup.sh
Created February 2, 2012 23:52
Using documentup with a local README.
# gem install bcat
curl -X POST --data-urlencode content@README.md http://documentup.com/compiled | bcat
@apotonick
apotonick / pure_ruby.rb
Created May 7, 2012 06:01
Cells in Sinatra, Webmachine, Love
require 'cell/base'
class FakeRoutes # should be sinatra's url helper instance
def url_for(*)
end
def named_routes # required due to a fucking stupid line in AbstractController::UrlFor#25 (3.2.3)
# super - _routes.named_routes.helper_names
Object.new.instance_eval do
@kneath
kneath / _README.md
Created November 18, 2009 21:42 — forked from defunkt/bundle.rake
Intelligent asset bundling for Rails (GitHub's asset bundling)

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js