This file contains 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
MyApp::Application.configure do | |
# Settings specified here will take precedence over those in config/application.rb. | |
# In the development environment your application's code is reloaded on | |
# every request. This slows down response time but is perfect for development | |
# since you don't have to restart the web server when you make code changes. | |
config.cache_classes = false | |
# Do not eager load code on boot. | |
config.eager_load = false |
This file contains 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
source 'https://rubygems.org' | |
ruby '2.1.5' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '~> 4.1.7' | |
gem 'haml-rails' | |
gem 'jquery-rails' | |
gem 'opal-rails', '~> 0.7.0.beta2' | |
gem 'opal-vienna', '~> 0.7.0' |
This file contains 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
#Sort the Ruby files in your project by number of has_many | |
ack " has_many " -c | awk -F ":" '{print $2,$1}' | grep -v "0" | sort -rn |
This file contains 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 GradePresenter | |
def initialize(grade) | |
@grade = grade | |
@@grade = grade | |
end | |
if @@grade.valid? | |
... | |
end | |
end |
This file contains 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
# place the contents of this file in, e.g., spec/re_run_friendly_formatter.rb | |
# | |
# and in .rspec: | |
# | |
# --format ReRunFriendlyFormatter | |
require "rspec/core/formatters/progress_formatter" | |
class ReRunFriendlyFormatter < RSpec::Core::Formatters::ProgressFormatter | |
RSpec::Core::Formatters.register self, :dump_summary |
This file contains 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 Adveli | |
class CalendarsController < BaseController | |
authorize_resource :class => Calendar | |
before_filter :authenticate_account! | |
def index | |
@personal_calendar = current_account.authenticatable.calendar | |
@classroom_calendars = current_account.authenticatable.classroom_calendars | |
@school_calendar = Calendar.school_calendar | |
if current_account.authenticatable_type == "Adveli::Teacher" |
This file contains 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
#!/usr/bin/env ruby | |
spec_hits = [] | |
checks = { | |
'_spec\.rb$' => ['focus:[:space:]*true'], | |
'\.rb$' => ['binding\.pry', 'debugger'] | |
} | |
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified | |
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n") |
This file contains 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
include Devise::Controllers::Helpers | |
Deface::Override.new(:virtual_path => 'my_engine/layouts/application', | |
:name => 'change_width_of_main_content_div', | |
:set_attributes => 'div#main_content', | |
:attributes => {:class => 'span10'}) if signed_in? |
This file contains 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
=> {"question"=> | |
{"description"=>"foobar", "points"=>"10", "answer_type"=>"MultipleChoice"}, | |
"correct_answer"=>"on", | |
"options"=>["Foo", "Bar"], | |
"authenticity_token"=>"", | |
"action"=>"create", | |
"controller"=>"adveli/quizzes/questions", | |
"quiz_id"=>"1"} |