Skip to content

Instantly share code, notes, and snippets.

View cantonic's full-sized avatar

Can Edremitoglu cantonic

  • Berlin / Germany
View GitHub Profile
# 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
class GradePresenter
def initialize(grade)
@grade = grade
@@grade = grade
end
if @@grade.valid?
...
end
end
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>
#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
@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'
@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 / gist:1bab6dfd7f7cd080b3ba
Created January 19, 2015 17:41
using Rails 4.1.9 on ruby 2.2.0
➜ ravioli git:(final-touch) ✗ rspec spec/features/navigation_spec.rb
/Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/fog-core-1.24.0/lib/fog/core/collection.rb:148: warning: circular argument reference - filters
/Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/fog-1.24.0/lib/fog/rackspace/mock_data.rb:42: warning: duplicated key at line 80 ignored: "name"
Setting up the application without customisations (NO presentation mode).
skipping fog configuration
/Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/actionpack-4.1.9/lib/abstract_controller/helpers.rb:154:in `rescue in block in modules_for_helpers': Missing helper file helpers//users/cantonic/sites/ravioli/app/helpers/application_helper.rb_helper.rb (AbstractController::Helpers::MissingHelperError)
from /Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/actionpack-4.1.9/lib/abstract_controller/helpers.rb:151:in `block in modules_for_helpers'
from /Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/actionpack-4.1.9/lib/abstract_controller/helpers.rb:14
# encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include Cloudinary::CarrierWave
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
alert "yippie"