create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
=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 |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
## 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; |
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 sessionDebugger
# 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 |
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 |
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'} %>
<% end %>