Skip to content

Instantly share code, notes, and snippets.

Eliot Sykes eliotsykes

Block or report user

Report or block eliotsykes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
eliotsykes /
Last active Aug 15, 2018
ActiveRecord::Base.configurations usage

Usage of ActiveRecord::Base.configurations with surrounding lines to help answer

Source: ~200 open source Rails apps and engines

~/dev/real-world-rails (master)
$ ag --ruby -C 15 'ActiveRecord::Base.config'
apps/alaveteli/config/initializers/alaveteli.rb:60-require 'user_spam_scorer'
apps/alaveteli/config/initializers/alaveteli.rb:61-require 'alaveteli_rate_limiter'
apps/alaveteli/config/initializers/alaveteli.rb:62-require 'alaveteli_spam_term_checker'
eliotsykes / versioned_migrations.rb
Created May 25, 2018
Versioned migrations support in Rails 4.2
View versioned_migrations.rb
# This file lives at config/initializers/versioned_migrations.rb
def supports_versioned_migrations?
Rails::VERSION::MAJOR >= 5
if supports_versioned_migrations?
puts "-"*80
puts "Versioned migrations are supported in your Rails version, you can safely delete file:"
puts __FILE__
puts "-"*80
eliotsykes /
Created Jan 22, 2018
Some open source Rails apps that use/used Skylight gem

Some open source Rails apps that use/used Skylight gem

Search done on collected Rails codebases at

$ ag -G Gemfile skylight
181:    skylight (0.10.6)
233:  skylight
eliotsykes / check_rollbar.rake
Last active Jul 27, 2017
Check Rollbar is reporting errors raised in rake tasks
View check_rollbar.rake
# Create file at lib/tasks/check_rollbar.rake
require 'securerandom'
# Run this with `heroku run rake check_rollbar`
desc "Check Rollbar reports errors raised in Rake tasks"
task check_rollbar: :environment do
unique_msg = "Hello from rake check_rollbar (unique identifier: #{SecureRandom.hex})"
raise ActiveRecord::RecordNotFound, unique_msg

Open Source AngularJS Rails Apps

Expect some false positives here, but hopefully most of these are open source Rails apps that use (or once used) AngularJS.

If you'd like to help update the list, please comment below with any of these apps you discover do not use AngularJS and include my username (@eliotsykes) in your message.

Confirmed using AngularJS

View original_bracket_validator.rb
require 'set'
def is_valid(code)
openers_to_closers = {
'(' => ')',
'{' => '}',
'[' => ']'
openers =
eliotsykes /
Created Apr 28, 2017
Open Source Rails apps using Sidekiq
eliotsykes /
Last active Sep 1, 2018
Multiline expressions in Ruby

How to break long lines up in Ruby

This page lists the options for breaking single-line expressions into multiple lines in Ruby.

Developers and teams need to come to their own decisions about which guideline(s) they prefer (preferences below are just my personal choices and I encourage you to disregard them).

# With trailing parens
x = [1, 2, 3].join(
eliotsykes /
Last active Mar 31, 2017
Extract Custom RSpec Matcher


expect(page).to have_css("h3", text: "Expected text here...")
click_button "Submit"
  have_css("h3", text: "Expected text here..."),
  "stay on page on invalid form submit"
eliotsykes / class_variables.rb
Last active Mar 16, 2017
Class Variables shared by all instances
View class_variables.rb
# 1. Create a file class_variables.rb with the contents below
# 2. Run the file with `ruby class_variables.rb` in Terminal
# 3. Review the output and the code below and explore why:
# - the class variable @@total_results_count correctly counts the number
# of all Result instances.
# - the class variable @@errors does not track the errors for
# a single instance, instead it wrongly tracks *all* errors
# for all Result instances.
You can’t perform that action at this time.