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
[ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ] || return | |
source /usr/local/share/chruby/chruby.sh | |
source /usr/local/share/chruby/auto.sh | |
chruby ruby-1.9.3 |
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
App.ApplicationRoute = Ember.Route.extend | |
setupController: () -> | |
@controllerFor('discussionPosts').set('model', App.DiscussionPost.find()) |
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 Board | |
def initialize | |
self.squares = Array.new(9) | |
end | |
def rows | |
self.squares.each_slice(3) | |
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
options = { | |
'x-amz-metadata-directive' => 'REPLACE', | |
'Content-Type' => 'application/pdf', | |
'Content-Disposition' => nil | |
} | |
count = 0 | |
files = directory.files.each do |file| | |
next unless file.key =~ /pdf\z/i | |
count += 1 |
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 Admin | |
class UsersController < ::AuthenticatedController | |
load_and_authorize_resource | |
def index | |
users = User.untrashed | |
render_with :users => users | |
end | |
def trashed |
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
FactoryGirl.define do | |
factory :user do | |
sequence(:email) { |n| "email#{n}@example.com" } | |
password "secret" | |
factory :admin do | |
after_build {|u| u.roles << :admin } | |
end | |
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
# Add this: | |
gem 'cells' |
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
# Generates the link to determine where the site bar switch button returns to. | |
def site_bar_switch_link(html_options = {}) | |
if admin? ? admin_switch_link(html_options) : frontend_switch_link(html_options) | |
end | |
def admin_switch_link(html_options = {}) | |
link_to t('.switch_to_your_website', site_bar_translate_locale_args), | |
session[:website_return_to] || refinery.root_path(:locale => (Refinery::I18n.default_frontend_locale if Refinery.i18n_enabled?)), | |
html_options | |
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
# Generates the link to determine where the site bar switch button returns to. | |
def site_bar_switch_link | |
if admin? ? admin_switch_link : frontend_switch_link | |
end | |
def admin_switch_link | |
link_url = session[:website_return_to].present? ? session[:website_return_to] : | |
refinery.root_path(:locale => (Refinery::I18n.default_frontend_locale if Refinery.i18n_enabled?)) | |
link_to t('.switch_to_your_website', site_bar_translate_locale_args), link_url, {:class => 'btn btn-primary'} |