Skip to content

Instantly share code, notes, and snippets.

View cantonic's full-sized avatar

Can Edremitoglu cantonic

  • Berlin / Germany
View GitHub Profile
@cantonic
cantonic / development.rb
Created January 19, 2015 10:07
`config.assets.raise_runtime_errors = true` doesn't take effect
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
@cantonic
cantonic / Gemfile
Last active August 29, 2015 14:12
parse error when trying to use opal-haml
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'
#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
Feature: user should see a second navigation in the sidebar
In order to have more content in the dashboard sidebar
As a user
I should see the same links in the sidebar like in the top navigation bar
Scenario Outline: user clicks on navigation links in sidebar
Given I am a logged in as <role>
And I am on the dashboard
When I click on <link_text> in the sidebar
Then I should be on <link_path>
class GradePresenter
def initialize(grade)
@grade = grade
@@grade = grade
end
if @@grade.valid?
...
end
end
# 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
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"
#!/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")
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?
=> {"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"}