Skip to content

Instantly share code, notes, and snippets.

View maxim's full-sized avatar
🛠️

Max Chernyak maxim

🛠️
View GitHub Profile
@maxim
maxim / foobar.rb
Created February 17, 2016 16:51 — forked from AJFaraday/foobar.rb
module Widgets
def self.extended(base)
class << base
attr_accessor :widgets
end
base.widgets = {}
end
def add_widget(name, widget)
@maxim
maxim / gary.rb
Created October 4, 2012 04:51 — forked from radar/gary.rb
["a b.c d.e"[/\.(\S+)$/, 1].split('.'), $`].reverse
class ActionController::TestCase
# setup :mock_warden
teardown :cleanup_warden_env
def warden
@_warden ||= mock
end
def mock_warden_for(*scopes)
scopes.each do |scope|
#!/usr/bin/env ruby
#
# usage: script/server_restarter
#
# Rails autoloading, while nice in theory, frequently doesn't work. Since Rails 2.3+
# is so fast when completely reloading the server, I wrote this script to listen to the
# given directories, and kill/restart the server when any file is changed.
#
# It's quick, simple, and it reliably reloads your application when changes are made.
#