Skip to content

Instantly share code, notes, and snippets.

@joakimk
joakimk / pipeline.md
Last active March 18, 2018 08:37
How we made our commit to production time twice as fast using heroku pipelines

Background

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
joakimk / File.md
Created September 11, 2016 13:18
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.

@joakimk
joakimk / elm-and-atom.md
Last active November 20, 2017 17:03
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
joakimk / jenkins_queue_optimizer.rb
Created March 30, 2012 11:31
Jenkins tool to remove old builds from queues so that only the latest commit gets run
require 'rubygems'
require 'httparty'
require 'nokogiri'
# This tool removes old builds from queues so that only the latest commit gets run.
# This way slow jobs won't fall behind, they will just skip commits upto the latest
# available commit that was successful in upstream projects.
class JenkinsQueueOptimizer
class Api
include HTTParty
@joakimk
joakimk / code.js
Last active June 12, 2017 17:38
#live_coding Simple example
/* jshint asi:true */
// PixiJS v4 example (WebGL rendering)
model = loadStateOrDefaultTo({
move: 1
})
tick = (delta) => {
if(codeHasChanged()) { return }
@joakimk
joakimk / research.md
Last active May 12, 2017 07:26
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
joakimk / gist:5999653
Created July 15, 2013 12:43
How to find schenker status for a hobbyking netherlands package via GLS.
http://privpakportal.schenker.nu/TrackAndTrace/packageinfo.aspx?packagesurrid=69682901&inpPackageId=<SSCC NO>
@joakimk
joakimk / graphite.rb
Created January 25, 2012 20:14
Graphite client for ruby with specs
require 'socket'
class Graphite
def initialize(host)
@host = host
end
def socket
return @socket if @socket && !@socket.closed?
@socket = TCPSocket.new(@host, 2003)
@joakimk
joakimk / post.md
Created March 30, 2012 11:40
Jenkins CI continous deployment

I'm working on something that will be way better than using jenkins to do continuous deployment, but here is how we do it today.

This is in reply to https://twitter.com/#!/haraldmartin/status/185683988063588352

What we want: For each revision, build it in steps, don't advance if the previous step failed. So that it can run a chain of steps like: unit_tests -> integration -> deploy staging -> deploy production.

If you just join projects in jenkins, and say rev-a passes in project-a, project-b might get rev-b. That's not good if project-b happens to be deploy-to-production and rev-b is broken.

We use: https://wiki.jenkins-ci.org/display/JENKINS/Join+Plugin And: https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

@joakimk
joakimk / config.ru
Created March 31, 2012 20:35
Notes on how to successfully run faye in a rails app using thin behind a https / SSL nginx proxy with basic auth
require 'faye'
Faye::WebSocket.load_adapter('thin')
use Faye::RackAdapter, :mount => '/faye', :timeout => 25
require ::File.expand_path('../config/environment', __FILE__)
run App::Application