Skip to content

Instantly share code, notes, and snippets.


Jakob Skjerning koppen

View GitHub Profile
# Chromedriver installer
# This script follows the process outlined on the ChromeDriver Version Selection
# page at to
# install a Chromedriver version that matches your currently installed version
# of Chrome.
# It installs the chromedriver binary into ~/bin/. If an existing chromedriver
# is installed it will be replaced by the updated binary.
koppen / configure.log
Last active Feb 22, 2021
Ruby 2.3, OpenSSL, RVM, macOS Mojave
View configure.log
configure: WARNING: you should use --build, --host, --target
checking for ruby... /Users/jakob/.rvm/rubies/ruby-2.6.0/bin/ruby
*** using http instead of https ***
config.guess already exists
*** using http instead of https ***
config.sub already exists
checking build system type... x86_64-apple-darwin18.7.0
checking host system type... x86_64-apple-darwin18.7.0
checking target system type... x86_64-apple-darwin18.7.0
checking whether the C compiler works... yes
koppen /
Last active Nov 26, 2021
To rocket or not

Alright, let's talk about the elephant in the room; hash rockets.

I get it, the JavaScript-style hash notation with colons is popular, but I still fail to see the benefit over the good, old hash rocket.

@samphippen recently wrote about this and his arguments pretty much reflect my own.

I openly admit to being biased but here are the arguments as I see them:

In favor of colons

koppen /
Created Nov 16, 2017
Download n URLs
while [ $COUNTER -lt 10 ]; do
wget "http://domæ$COUNTER"
koppen / delayed_job_helpers.rb
Last active Sep 28, 2020
Delayed::Job helpers
View delayed_job_helpers.rb
module Delayed::Job::Ext
# Returns all failed jobs
def failed_jobs
Delayed::Job.where.not(:last_error => nil).order(:failed_at)
def failed_with(message)
View fizz.rb
def do_stuff
list = [1, 2, 3, 4, 5] { |value|
return "Fizz" if value == 3
p do_stuff
View presenter.rb
# frozen_string_literal: true
# A generic presenter class
class Presenter < SimpleDelegator
attr_reader :view
class << self
# Returns true if object has been wrapped in a Presenter
def decorated?(object)
koppen / repro.rb
Created Sep 14, 2016
Reproduction steps for ActiveRecord `touch` not clearing changes in `lock_version` when used with optimistic locking
View repro.rb
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
gem "rails", github: "rails/rails"
View recreate_activerecord_models.rb
# Recreate ActiveRecord models from Delayed Job jobs.
# Ensure that we recreate the full model
ActiveRecord::Base.partial_updates = false
Delayed::Job.all.each do |job|
# Deserialize the Delayed Job handler. As we've been using the `.delay` syntax
# and no custom jobs, this returns a Delayed::PerformableMethod
pfm = YAML.load(job.handler)
View foo.sql
SELECT * FROM (SELECT * FROM unnest(string_to_array('janson morke nils', ' '))) a, (SELECT * FROM unnest(string_to_array('janson morke nils', ' '))) b;