Skip to content

Instantly share code, notes, and snippets.

jonah-williams / tap.swift
Last active October 31, 2020 14:37
Implementing a Ruby `tap` equivalent in Swift
// I wanted an equivalent to Ruby's `tap` ( in Swift which I could mix into any type to tap into method chains.
// Define the interface we want to provide as a protocol
private protocol Tap {
func tap(block: (Self) -> Void) -> Self
// Extend the `Tap` protocol with a default implementation
private extension Tap {
func tap(block: (Self) -> Void) -> Self {
jonah-williams /
Created March 18, 2014 17:49
Default iOS project configuration patterns

iOS Project Template

  1. Install .ruby-version
  2. Install gemfile with pods dependency
  3. Install CocoaPods for dependency management
  4. Install Kiwi pod for unit tests
  5. Install objection pod for IoC
  6. Install KIF pod for acceptance specs
  7. Reorganize file structure; groups match file system folders, split out groups based on features or roles
  8. Define views in nib files by default; designer editable, easier auto-layout configuration, easier localization
jonah-williams / circle.yml
Last active May 29, 2019 14:53
Automating deployments to Heroku from CircleCI
- bundle exec rspec spec
branch: master
timeout: 300


Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?
jonah-williams / KWSpec+WaitFor.h
Last active October 7, 2015 01:38
Delay execution of Kiwi specs until an asynchronous process finishes.
#import "KWSpec.h"
@interface KWSpec (WaitFor)
+ (void) waitWithTimeout:(NSTimeInterval)timeout forCondition:(BOOL(^)())conditionalBlock;
jonah-williams /
Created April 30, 2011 17:46
Command line iOS project builds and over-the-air distribution
# command line OTA distribution references and examples
jonah-williams / api_docs.rake
Created April 21, 2011 16:19
Instrumenting rspec and using a custom formatter to generate API docs from specs. See
require 'rubygems'
require 'rspec/core/rake_task'
namespace :project_name do
namespace :api do
desc 'Generate API request documentation from API specs''generate_docs') do |t|
t.pattern = 'spec/controllers/api/**/*_spec.rb'
t.rspec_opts = ["-Ilib/tasks/api_docs", "-rinstrument_specs", "-rapi_formatter", "--format APIFormatter"]
~/Applications/UniversalIndentGUI/indenters/uncrustify -l OC -q -c ~/Applications/UniversalIndentGUI/config/uncrustify_obj_c.cfg
#!/usr/bin/env python
import sys, subprocess, re
RX_SUITE_START = re.compile(r"Test Suite '(?P<suitename>\w+)' started at (?P<date>[\d\-]+) (?P<time>[\d\:]+) (?P<tz>[\d\-\+]+)")
RX_SUITE_END = re.compile(r"Test Suite '(?P<suitename>\w+)' finished at (?P<date>[\d\-]+) (?P<time>[\d\:]+) (?P<tz>[\d\-\+]+)")
RX_TEST_START = re.compile(r"Test Case '(?P<testname>[^']+)' started\.")
RX_TEST_END = re.compile(r"Test Case '(?P<testname>[^']+)' passed \((?P<sec>[\d\.]+) seconds\)\.")
RX_TEST_FAIL = re.compile(r"Test Case '(?P<testname>[^']+)' failed \((?P<sec>[\d\.]+) seconds\)\.")
jonah-williams / default.rb
Created March 16, 2010 23:36 — forked from ezmobius/default.rb
chef recipe to add delayed_job workers to monit to run them on Engine Yard cloud instances
# Cookbook Name:: delayed_job
# Recipe:: default
node[:applications].each do |app_name, data|
user = node[:users].first
case node[:instance_role]
when "solo", "app", "app_master"