Skip to content

Instantly share code, notes, and snippets.

@israelb
israelb / README.md
Created October 25, 2013 15:17 — forked from dergachev/README.md

Vagrant Setup

This tutorial guides you through creating your first Vagrant project.

We start with a generic Ubuntu VM, and use the Chef provisioning tool to:

  • install packages for vim, git
  • create user accounts, as specified in included JSON config files
  • install specified user dotfiles (.bashrc, .vimrc, etc) from a git repository

Afterwards, we'll see how easy it is to package our newly provisioned VM

require "bundler/capistrano"
server "96.126.100.112", :web, :app, :db, primary: true
set :application, "capteste"
set :user, "deployer"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false
set :port, "3030"
@israelb
israelb / 01.rb
Last active August 29, 2015 13:56
http://stackoverflow.com/questions/6086120/helper-fields-for-not-working
http://www.sitepoint.com/complex-rails-forms-with-nested-attributes/
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_objects import RGBColor
import argparse
import math
require 'benchmark'
require 'pry'
class Fizzbuzz
def initialize(number)
@number = number
end
def self.count(number)
count = new(number)
class Agent < ActiveRecord::Base
validates :first_name, :last_name, :email, presence: true
validates :email, uniqueness: true
has_many :missions
scope :on_assignment, -> { Agent.joins(:missions).where(missions: { status: 'active' }) }
scope :not_on_assignment, -> { where.not(id: Agent.on_assignment.pluck(:id)) }
def name
"#{first_name} #{last_name}"
end
inputs = %w[
CollectionSelectInput
DateTimeInput
FileInput
GroupedCollectionSelectInput
NumericInput
PasswordInput
RangeInput
StringInput
TextInput
%ng-form(name="circleEditForm")
%label Circle Name:
%input(type="text" name="circleName" |
ng-minlength= 3 |
ng-model="circleModal.name" |
ng-maxlength= 8 |
maxlength= 8 |
required |
ng-class="{error: !circleEditForm.circleName.$valid}" )
class Car < ActiveRecord::Base
attr_accessible :make, :car_model, :colour
def lots_of_model_code
# etc, etc
end
end

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.