Skip to content

Instantly share code, notes, and snippets.

View ffullenk's full-sized avatar

Francisco Fullenkamp ffullenk

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')
class ApplicationController < ActionController::Base
protect_from_forgery
rescue_from CanCan::AccessDenied do |exception|
flash[:alert] = exception.message
redirect_to root_url
end
protected
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@coopermaruyama
coopermaruyama / vendor-ffmpeg-heroku
Created October 27, 2012 08:39
Install FFMpeg on heroku (Rails)
## Get FFMpeg working on heroku by building binaries using vulcan
gem install vulcan
vulcan create foo
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
// The name of the spreadsheet from the browser location bar.
// Copy after 'key=' until before the next URL parameter beginning w/&
var SPREADSHEET_ID = 'YOUR_SPREADSHEET_ID';
// The name of the sheet, displayed in a tab at the bottom of the spreadsheet.
// Default is 'Sheet1' if it's the first sheet.
var SHEET_NAME = 'YOUR_SHEET_NAME';
function doGet(request) {
var callback = request.parameters.jsonp;
-- Function: clone_schema(text, text)
DROP FUNCTION clone_schema(text, text);
CREATE OR REPLACE FUNCTION clone_schema(source_schema text, dest_schema text)
RETURNS void AS
$BODY$
DECLARE
seq RECORD;
@lfender6445
lfender6445 / gist:9919357
Last active May 13, 2025 16:00
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@ryantownsend
ryantownsend / carrierwave_direct.rb
Created April 17, 2014 04:22
Patches CarrierWave Direct to fix signature not matching errors, as per https://github.com/dwilkie/carrierwave_direct/pull/128
# config/initializers/carrierwave_direct.rb
require "carrierwave_direct"
module CarrierWaveDirect
module SignatureFixMonkeyPatch
def policy(options = {})
options[:expiration] ||= upload_expiration
options[:min_file_size] ||= min_file_size
options[:max_file_size] ||= max_file_size
@temochka
temochka / postmark_rails_headers.rb
Created April 29, 2014 14:39
An example of sending custom headers with postmark-rails and ActionMailer
class TestMailer < ActionMailer::Base
def email
headers['X-Tag-Via-Hash-Access'] = 'value'
headers 'X-Tag-Via-Headers-Method' => 'value'
mail(to: '[email protected]', from: '[email protected]', subject: 'Headers test') do |format|
format.text { render text: 'Headers test' }
end
@blairanderson
blairanderson / simple_form_select_with_data.md
Last active December 4, 2018 15:07
Rails Bootstrap Simple_Form Select with Data Attributes

This was super annoying so i decided to write it down.

I needed to add some data attributes to a simple_form input(f.input :people, as: :select) and also maintain the bootstrap classes

Here's how i solved it:

<%= f.input :car_id, label: 'Select a Car' do %>
    <%= f.select :car_id, @cars.map { |car| [car.name, car.id, {'data-car-price' => car.current_price}] }, {include_blank: true}, {class: 'form-control'} %>
&lt;% end %&gt;