Skip to content

Instantly share code, notes, and snippets.

View mAlishera's full-sized avatar

Ekaterina mAlishera

  • Berlin, Germany
View GitHub Profile
@mAlishera
mAlishera / my_middleware.rb
Created February 18, 2017 17:02
MyMiddleware with PG::ConnectionBad rescue
class MyMiddleware
def initialize(app)
@app = app
end
def call(env)
dup._call(env)
end
def _call(env)
@mAlishera
mAlishera / application.rb
Created February 18, 2017 16:51
Adding custom middleware
...
class Application < Rails::Application
...
config.middleware.insert_before "ActionDispatch::Callbacks", "MyMiddleware"
...
...
@mAlishera
mAlishera / Gemfile
Created January 23, 2017 23:09
Composite primary key with ActiveRecord
...
gem 'composite_primary_keys', '=8.1.5'
...
@mAlishera
mAlishera / create_users.rb
Created January 23, 2017 22:35
timestamps in AR
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
...
t.datetime 'inserted_at', null: false
t.datetime 'updated_at', null: false
end
end
end
@mAlishera
mAlishera / ecto_migration.exs
Created January 23, 2017 22:15
Composite primary key in Ecto
defmodule Messaging.Repo.Migrations.CreateGroupChatVersions do
use Ecto.Migration
def change do
create table(:group_chat_versions, primary_key: false) do
add :group_chat_id, :uuid, primary_key: true
add :version, :integer, primary_key: true
timestamps
end
@mAlishera
mAlishera / input_maska_spec.rb
Last active August 29, 2015 14:24
input_maska_spec.rb
def maskarad(input, maska)
input = input.to_s.chars
maska.gsub(/@/) do |at|
input.shift
end.gsub(/^-*/, '').gsub(/-*$/, '') + input.join
end
=begin Input data
Маска | Номер | Результат

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.