Skip to content

Instantly share code, notes, and snippets.

Ian Ker-Seymer ianks

View GitHub Profile
View Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
# gem "rails"
gem "puma", "~> 3.12"
gem "guard-puma", "~> 0.5.0"
@ianks
ianks / docker-compose.yml
Last active Jun 6, 2018
Threads in google-cloud-pubsub
View docker-compose.yml
---
version: '3.6'
services:
pubsub:
image: adhawk/google-pubsub-emulator
ports:
- 8085:8085
@ianks
ianks / slugify.sql
Last active Jun 15, 2018
Generating Slugs in Postgres
View slugify.sql
CREATE EXTENSION IF NOT EXISTS "unaccent"
CREATE OR REPLACE FUNCTION slugify("value" TEXT)
RETURNS TEXT AS $$
-- removes accents (diacritic signs) from a given string --
WITH "unaccented" AS (
SELECT unaccent("value") AS "value"
),
-- lowercases the string
"lowercase" AS (
View keybase.md

Keybase proof

I hereby claim:

  • I am ianks on github.
  • I am ianks (https://keybase.io/ianks) on keybase.
  • I have a public key whose fingerprint is 7E9D 6E06 C304 B6F3 9E18 C44B 5973 1153 87DF BE93

To claim this, I am signing this object:

View Gemfile
source 'https://rubygems.org'
gem 'curb'
@ianks
ianks / Gemfile
Created Sep 7, 2017
Gemfile.lock
View Gemfile
source 'https://rubygems.org'
gem 'curb'
View nullable.ts
function maybePrint(x?: string) {
if (x != null) {
// we know that x will be a string in this scope
console.log(x);
}
}
View ts1.ts
interface Named {
name: string;
}
let x: Named;
let y = { name: "John", age: 42 };
// This is OK because Y meets the interface requirements of Named
x = y;
View fixed.rb
# ...
expectation_mutex = Mutex.new
expect(client).to receive(:fetch_users) do |args|
expectation_mutex.synchronize do
expect(args).to eql(current_page)
end
# ...
end
View makes_request.rb
it 'makes two requests to resolve the users when necessary' do
current_page = 1
expectation_mutex = Mutex.new
expect(client).to receive(:fetch_users).exactly(2).times do |args|
expect(args).to eql(current_page)
current_page += 1
You can’t perform that action at this time.