A ZSH theme optimized for people who use:
- Solarized
- Git
- Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)
For Mac users, I highly recommend iTerm 2 + Solarized Dark
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
#!/usr/bin/env ruby | |
require 'json' | |
require 'time' | |
class Time | |
module Units | |
Second = 1 | |
Minute = Second * 60 | |
Hour = Minute * 60 | |
Day = Hour * 24 |
require 'csv' | |
module MungeData | |
# Open a tab-delimited data file converting it into a CSV structure, | |
# expecting the first row to be headers, | |
# passing the table to map each row of the table, | |
# converting each row to a hash and then selecting only | |
# those items in the array that match the characteristics in the block | |
def self.extract_years(censusdata, y_start, y_end) |
<?php | |
class CalendarEvent { | |
/** | |
* | |
* The event ID | |
* @var string | |
*/ | |
private $uid; |
Update: I no longer work for the company and this challenge is no longer used, but I'll leave the gist here in case people want to practice.
Using Ruby on Rails we would like you to create a simple expert search tool. The application should fulfill the requirements below. The source code must be placed in a public repo on GitHub. The application should be deployable on Heroku.
# This is a skeleton for testing models including examples of validations, callbacks, | |
# scopes, instance & class methods, associations, and more. | |
# Pick and choose what you want, as all models don't NEED to be tested at this depth. | |
# | |
# I'm always eager to hear new tips & suggestions as I'm still new to testing, | |
# so if you have any, please share! | |
# | |
# This skeleton also assumes you're using the following gems: | |
# | |
# rspec-rails: https://github.com/rspec/rspec-rails |
#!/usr/bin/env ruby | |
# Usage: hcsv DBNAME TBLNAME HSTORECOL | |
# Output columns will be id + all the hstore keys | |
dbname, tblname, hstorecol = ARGV[0..2] | |
# Get hstore keys | |
out = `psql #{dbname} --tuples --command "SELECT DISTINCT k FROM (SELECT skeys(#{hstorecol}) AS k FROM #{tblname}) AS dt ORDER BY k"` | |
headers = out.split(/\n/).map(&:strip) |
# Eager (non-lazy) sequence generation: | |
(0..8).each_cons(2).map { |a,b| a + b } | |
# Another form (of above) | |
(1..10).each_with_object([1]) { |i,a| a[i] = a[i-1] + 2 } | |
# Eager Fibonacci (generates n+1 Fibonacci numbers) | |
(2..10).each_with_object([0,1]) { |i,a| a[i] = a[i-2] + a[i-1] } | |
# Corrected for n = 1 or 2, and removed extra number |
:javascript | |
$(document).ready(function() { | |
window.loadIngredientSuggestionsEditor(#{@ingredients}); | |
}); | |
%h1 Edit ingredient suggestions | |
#js-ingredient-suggestions-editor |