This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # See https://gist.github.com/1151655 for a tip how to save access token and secret in an omniauth callback. | |
| class LinkedinFactory | |
| API_KEY = "123" | |
| SECRET_KEY = "456" | |
| def self.authorize_user(user) | |
| token = user.linkedin_connection.token | |
| secret = user.linkedin_connection.secret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def do_it(options = {}) | |
| puts options.inspect | |
| end | |
| # new syntax: | |
| do_it(user_type: :vip) | |
| # => {:user_type=>:vip} | |
| # old syntax | |
| do_it(:user_type => :vip) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ApplicationHelper | |
| # In your layout: <body <%= render_page_data %>> | |
| # | |
| def render_page_data | |
| @page_data_attributes.html_safe if @page_data_attributes.present? | |
| end | |
| # Appends a hash of data attributes to the body element. For example: | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :deploy do | |
| desc "Hot-reload God configuration for the Resque worker" | |
| task :reload_god_config do | |
| sudo "god stop resque" | |
| sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}" | |
| sudo "god start resque" | |
| end | |
| end | |
| # append to the bottom: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rake aborted! | |
| ruby /home/marko/.rvm/rubies/ruby-1.9.2-p180/bin/ruby -S rspec ./spec/helpers/sessions_helper_spec.rb ./spec/helpers/users_helper_spec.rb | |
| <<other spec files>> failed | |
| /home/marko/devel/foo/vendor/bundle/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/rake_task.rb:149:in `block (2 levels) in initialize' | |
| /home/marko/devel/foo/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose' | |
| /home/marko/devel/foo/vendor/bundle/ruby/1.9.1/gems/rspec-core-2.7.1/lib/rspec/core/rake_task.rb:139:in `block in initialize' | |
| /home/marko/devel/foo/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `call' | |
| /home/marko/devel/foo/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute' | |
| /home/marko/devel/foo/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `each' | |
| /home/marko/devel/foo/vendor/bundle/ruby/1.9.1/gems/rake-0.8.7/lib/rake.rb:631:in `execute' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| rescue_from 'Exception' do |exception| | |
| logger.info exception | |
| logger.info exception.backtrace.join("\n") | |
| render :head => 500 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| set -o vi | |
| eval `ssh-agent` | |
| ssh-add ~/.ssh/id_rsa | |
| export PS1="\w ★ " | |
| export LANGUAGE="en" | |
| export LANG="C" | |
| export LC_MESSAGES="C" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| def find_form(id) | |
| company.forms.find(id) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController < ActionController::Base | |
| rescue_from Exception do |exception| | |
| logger.error exception.backtrace.join("\n") | |
| head 500 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # either irb --noecho, or | |
| conf.echo = false |