Skip to content

Instantly share code, notes, and snippets.

View ryansobol's full-sized avatar

Ryan Sobol ryansobol

  • Ryan Sobol LLC
  • Seattle, WA
  • 12:09 (UTC -07:00)
View GitHub Profile
@ryansobol
ryansobol / gist:5252653
Last active November 22, 2023 11:53
15 Questions to Ask During a Ruby Interview

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.

@ryansobol
ryansobol / symbols.md
Last active May 27, 2022 17:34
Symbols in Ruby

What's a Symbol and why is it imporant?

In Ruby, a Symbol is the most efficient way, in terms of time and memory, to represent a set of characters.

What does a Symbol look like?

Most commonly, a Symbol is a single word prefixed by a colon:

:hello
@ryansobol
ryansobol / hashes.md
Last active April 7, 2022 15:02
Hashes in Ruby

What's a Hash and why is it important?

A Hash is a collection of key-value pairs. To add, fetch, modify, and delete a value from a Hash, you refer to it with a unique key.

While an Array is indexed by Integers only, a Hash is keyed by any object -- Strings, Integers, etc.

In other programming languages, a Hash might be known as an 'associative array', 'dictionary', or 'HashMap'.

What does a Hash look like?

@ryansobol
ryansobol / Array+Permutations.swift
Last active August 12, 2021 15:38
Generate the permutations of a Swift array
extension Array {
func chopped() -> (Element, [Element])? {
guard let x = self.first else { return nil }
return (x, Array(self.suffix(from: 1)))
}
}
print([1, 2, 3].chopped())
// Optional((1, [2, 3]))
#!/bin/sh
# because gconftool doesn't have "append"
glist_append() {
local type="$1"; shift
local key="$1"; shift
local val="$1"; shift
local entries="$(
{
#!/usr/bin/env ruby
#
# Shorten a GitHub URL to a git.io URL
# v1.2.0 - Copyright (c) 2016 Ryan Sobol - The MIT License
#
# Usage: gitio URL [code]
#
# Examples:
# $ gitio https://github.com/ryansobol ryansobol
# https://git.io/ryansobol
@ryansobol
ryansobol / README.md
Last active September 25, 2018 15:14 — forked from IanSmith89/README.md
Galvanize Bookshelf Validations

Server-side Validations for Galvanize Bookshelf

Change into your project directory.

cd galvanize-bookshelf

Ensure the staging area of the master branch is clean. Then, create and checkout a new feature branch.

HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 445
Content-Type: application/json; charset=utf-8
Date: Wed, 05 Jul 2017 04:22:10 GMT
Server: openresty
X-Cache-Key: /data/2.5/weather?APPID=cc4654c8e15f6d08b13954b915a0d0b1&q=seattle

Good etiquette in class can help you make the most of your education.

You're an adult; act like one.

If you're in Code Fellows, you're likely at least 18 years old—the age at which you're legally considered an adult. You may not feel like a responsible grown-up yet, but your instructors will assume that you are. So act likewise.

Before you say or do anything in the classroom, ask yourself "How would a mature, well-adjusted, courteous adult act?" I promise that doing so will save you from embarrassment and engender the respect of your classmates and instructors.

Present yourself well.

git config --global alias.c 'commit -m'
git config --global alias.st 'status --short --branch'
git config --global alias.ca 'commit --amend --reuse-message=HEAD'
git config --global alias.co 'checkout'
git config --global alias.br 'branch'
git config --global alias.df 'diff HEAD'
git config --global alias.ir $'!sh -c \'git rebase --interactive ${1-master}\' -'
git config --global alias.ll 'log --graph --all --pretty=format:"%Cred%h %>(11,trunc)%Cgreen%cr %<(10,trunc)%Cblue%cn%C(yellow)%d %Creset%s"'
git config --global alias.la 'log --patch --stat --pretty=format:"%C(bold red)%h %Cgreen%cr %Cblue%cn%C(yellow)%d %Creset%s"'
git config --global alias.dfs 'diff --staged'