View trace_calls.rb
module TraceCalls
def self.included(base)
[base, base.singleton_class].each do |klass|
klass.instance_methods(false).each do |existing_method|
wrap(klass, existing_method)
end
end
def base.method_added(method)
TraceCalls.run_method_added(self, method, __method__)
View inheritance_hierarchy.rb
module Extendable # :nodoc:
def self.extended(base)
base.include InstanceMethods
end
module InstanceMethods # :nodoc:
def hello
puts 'hello from Extendable'
super
end
View move_heroku_pg_to_aws_rds.md
  1. Prepare your RDS instance and [authorize access to it]1.

  2. Put your app in maintenance mode:

    heroku maintenance:on
  3. Save the latest SQL dump of the DB:

View keybase.md

Keybase proof

I hereby claim:

  • I am halilim on github.
  • I am halil (https://keybase.io/halil) on keybase.
  • I have a public key whose fingerprint is A008 B2E0 8F6A 766C 707B 449B 99D4 1574 5D45 32C6

To claim this, I am signing this object:

View ruby_cryptology.rb
CIPHER = { 'a' => 'n', 'b' => 'o', 'c' => 'p', 'd' => 'q',
'e' => 'r', 'f' => 's', 'g' => 't', 'h' => 'u',
'i' => 'v', 'j' => 'w', 'k' => 'x', 'l' => 'y',
'm' => 'z', 'n' => 'a', 'o' => 'b', 'p' => 'c',
'q' => 'd', 'r' => 'e', 's' => 'f', 't' => 'g',
'u' => 'h', 'v' => 'i', 'w' => 'j', 'x' => 'k',
'y' => 'l', 'z' => 'm' }.freeze
REVERSE_CIPHER = CIPHER.invert.freeze
View assets.rb
# config/initializers/assets.rb
# ...
# The last two are for the file browser
Rails.application.config.assets.precompile += %w(ckeditor/config ckeditor/application ckeditor/filebrowser/*)
View helpers.rb
# spec/support/helpers.rb
require 'support/helpers/i18n_helpers'
# ...
RSpec.configure do |config|
config.include Features::I18nHelpers, type: :feature
# ...
end
View Chewy_price_filter.rb
# Assumes gems: Chewy, Money and eu_central_bank
class SearchForm
include ActiveModel::Model
DEFAULTS = { 'currency' => 'TRY' }
attr_accessor :price_min, :price_max, :currency
# ...
View digitize_benchmark.rb
require 'benchmark/ips'
def digits_s(n)
n.to_s.chars.map(&:to_i)
end
# http://stackoverflow.com/a/12909952/372654
def digits_divmod(n)
n = n.abs
[].tap do |result|
View Amazon Elastic Beanstalk Rails.md

Last Status

  • 2015-11-10: Abandoned AWS EB.

    Got Create environment operation is complete, but with errors. For more information, see troubleshooting documentation..

    Tried to set up CloudWatch Logs but got The following resource(s) failed to create: [AWSEBCWLHttp4xxMetricFilter, AWSEBCWLHttp5xxMetricFilter].