Skip to content

Instantly share code, notes, and snippets.

View anicholson's full-sized avatar

Andy Nicholson anicholson

View GitHub Profile
@anicholson
anicholson / RSpec 3.2.3 output
Created May 13, 2015 03:14
Why don't RSpec instance_doubles honour the entire object API?
$ rspec sorting_spec.rb
F
Failures:
1) SortableThing can be sorted
Failure/Error: sorted = [thing1, thing2].sort
ArgumentError:
comparison of RSpec::Mocks::InstanceVerifyingDouble with RSpec::Mocks::InstanceVerifyingDouble failed
# ./sorting_spec.rb:20:in `sort'
module Hangman (Model, Letter, initialModel, Action, update, view, main) where
{-| A hangman game in Elm.
@docs Model
@docs Letter
@docs Action
@docs initialModel
@docs update
@docs view
@anicholson
anicholson / keybase.md
Created December 9, 2015 00:20
keybase.md

Keybase proof

I hereby claim:

  • I am anicholson on github.
  • I am andrewdotnich (https://keybase.io/andrewdotnich) on keybase.
  • I have a public key ASD9uQS7he9dDqhPl638kbWfHGifEyTiqlDvbNh1UGpA9Qo

To claim this, I am signing this object:

# A sample Gemfile
source "https://rubygems.org"
gem 'rack'
gem 'roda'
Here's a minimal schema that fails when input has stringified keys, and passes with symbolized keys.
#!/bin/bash
wait_until_up () {
echo "Waiting for $1 to come up!"
until $(curl --output /dev/null --silent --fail "$2"); do
printf '.'
sleep 1
done
@anicholson
anicholson / README.md
Created August 31, 2016 06:21
Crystal Language resources

Installing Crystal

  • On OSX: brew install crystal-lang
  • On Linux: [See instructions][installation_instructions]
  • On Windows: Sorry, not yet. You may be able to, but it’s not officially supported.

Further talks

  • [Matz' Keynote @ RubyConf 2014][matz]
  • [Consider Static Typing: Tom Stuart @ RubyConfAU 2015][stuart]
@anicholson
anicholson / Dockerfile
Last active October 23, 2016 22:24
Crystal Ubuntu package does not install all required dependencies
FROM ubuntu
MAINTAINER Andy Nicholson <andrew@anicholson.net>
RUN apt-get update && \
apt-get install -y apt-transport-https && \
apt-key adv --keyserver keys.gnupg.net --recv-keys 09617FD37CC06B54 && \
echo "deb https://dist.crystal-lang.org/apt crystal main" > /etc/apt/sources.list.d/crystal.list && \
apt-get update && \
apt-get install -y crystal
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require_relative '../config/environment'
require 'rack'
# Take the whole script down if anything goes remotely wrong
Thread.abort_on_exception = true
user system total real
Run 0 14.010000 0.470000 14.480000 ( 2.773481)
Run 1 2.700000 0.210000 2.910000 ( 0.635449)
Run 2 1.170000 0.010000 1.180000 ( 0.300033)
Run 3 1.930000 0.080000 2.010000 ( 0.372750)
Run 4 1.430000 0.020000 1.450000 ( 0.325396)
Run 5 1.460000 0.020000 1.480000 ( 0.346627)
Run 6 1.350000 0.060000 1.410000 ( 0.366876)
Run 7 1.230000 0.020000 1.250000 ( 0.356951)
Run 8 1.020000 0.010000 1.030000 ( 0.452953)