Skip to content

Instantly share code, notes, and snippets.

View cantonic's full-sized avatar

Can Edremitoglu cantonic

  • Berlin / Germany
View GitHub Profile
ActionView::Template::Error: ReferenceError: window is not defined
from Object.<anonymous> ((execjs):43890:2)
from __webpack_require__ ((execjs):43857:30)
from (execjs):43877:18
from (execjs):43880:10
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:15:in `rescue in block in initialize'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:12:in `block in initialize'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:75:in `block in lock'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:73:in `Locker'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:73:in `lock'
@cantonic
cantonic / autocommit.sh
Created July 19, 2016 19:50 — forked from trcook/autocommit.sh
auto commit git. use fswatch to setup a file to auto-commit a git repo on file change
#!/bin/bash
# requires fswatch
fswatch -o . -e "\\.git.*"| xargs -n1 -I{} git commit -am "snapshot from autocommit_script.sh"
@cantonic
cantonic / backup.sh
Created July 18, 2016 21:02
Backup multiple dokku postgres instances and upload them to a bucket in S3
#!/bin/bash
S3KEY="CHANGE_ME"
S3SECRET="CHANGE_ME"
bucket='CHANGE_ME'
region='CHANGE_ME'
declare -a apps=("app1" "app2")
echo "Starting to backup - $(date)"
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"}
class Quiz < ActiveRecord::Base
belongs_to :teacher
attr_accessible :time_limit, :title
validates_presence_of :title, :time_limit
validates :time_limit, :numericality => { :only_integer => true, :greater_than => 0 }
has_many :quiz_questions, :dependent => :destroy
has_many :true_false_questions, :through => :quiz_questions, :source => :question, :source_type => 'Adveli::TrueFalseQuestion', :dependent => :destroy
end
1) Quizzer::TrueFalseQuestion
Failure/Error: it { should have_one(:quiz_question) }
NoMethodError:
undefined method `has_one?' for #<Quizzer::TrueFalseQuestion:0x007fa4d08d1928>
# ./spec/models/quizzer/true_false_question_spec.rb:4:in `block (2 levels) in <top (required)>'
module MyApp
class Application < Rails::Application
if Rails.env == 'test'
require 'diagnostic'
config.middleware.use(MyApp::DiagnosticMiddleware)
end
end
end