Skip to content

Instantly share code, notes, and snippets.

joakimk /
Last active Feb 25, 2021
Building custom ruby images to use the latest versions (e.g. to get security fixes earlier)

Building custom ruby-alpine

Check the alpine version of the previous image.

alpine3.9 master$ docker run -it ruby:2.5.4-alpine sh
/ # cat /etc/alpine-release 
/ # ruby -v
ruby 2.5.4p155 (2019-03-13 revision 67245) [x86_64-linux-musl]
joakimk /
Last active Apr 5, 2018
Running tests in tmux from Atom
# Atom -> Init Script...
child = require "child_process"
runTestInTmux = (focus) ->
editor = atom.workspace.getActiveTextEditor()
fullPath = editor.getPath()
projectPath = atom.project.getDirectories()[0].getPath() + "/"
joakimk /
Last active Mar 18, 2018
How we made our commit to production time twice as fast using heroku pipelines


We started out with two apps.

  • foo-staging
  • foo-production

Our CI would run tests, then deploy to staging, run smoke tests and then run to production and run smoke tests.

This took about 22-25 min.

joakimk / webpacker-environment.js
Last active Oct 11, 2018
non-digested assets in webpack (e.g. non-stupid-digest-assets for webpacker)
View webpacker-environment.js
// Didn't find anything on google for this so I wrote my own. Use as a starting point if you have a similar problem.
// Please write comments if there is a better way to do this (or solve the same problem in another way) in webpack.
// Contents of config/webpack/environment.js:
const { environment } = require('@rails/webpacker')
// Generate undigested assets for use in embedded javascript, emails, etc.
// We previously used non-stupid-digest-assets for this.
joakimk /
Last active Nov 20, 2017
Elm and Atom setup

Some notes on my Elm development environment.

The most important thing is elm-format. It auto-formats the code when you save. You will likely miss this in other languages.

  1. brew install elm elm-format
  2. Install Atom
  3. Elm plugins: elm-format language-elm
  4. Vim plugins: ex-mode vim-mode-plus

Currently evaluating the elmjutsu plugin.

joakimk / code.js
Last active Jun 12, 2017
#live_coding Simple example
View code.js
/* jshint asi:true */
// PixiJS v4 example (WebGL rendering)
model = loadStateOrDefaultTo({
move: 1
tick = (delta) => {
if(codeHasChanged()) { return }
joakimk /
Last active May 12, 2017
Research: Why is single Elixir unit tests slow to run?

Instant-feeling unit tests improves productivity and developer happiness :)

Elixir tooling isn't quite there the way Ruby can be when optimized.

Ruby benchmarks:

  • instant 46ms base time (time ruby -e "")
  • instant 190ms running a ruby unit test doing nothing
  • in 50k line rails app:
    • okay 640ms bundler (time bundle exec ruby -e "")
joakimk /
Last active Oct 6, 2016
A collection of good talks and articles by topic. Elixir, Elm, Ruby, ...

Building a little list so I can more easily recommend the best talks and be able re-watch them myself.


joakimk / Update.elm
Last active Sep 22, 2016
One attempt at simple adding or updating a record in a list in Elm
View Update.elm
import UpdateList exposing (addOrUpdateById)
update msg model =
case msg of
NewOrUpdatedItem item ->
({model | items = model.items |> addOrUpdateById item}, Cmd.none)
joakimk /
Created Sep 11, 2016
heroku: Could not connect to database to initialize transfer

If you're seeing this error, try heroku ps:scale web=0 then import the database again and run heroku ps:scale web=1 afterwards. Found nothing on google for this error, so posting this gist with the solution that worked for me. Could have been a temporary error too.