Skip to content

Instantly share code, notes, and snippets.

Joakim Kolsjö joakimk

Block or report user

Report or block joakimk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joakimk
joakimk / jenkins_queue_optimizer.rb
Created Mar 30, 2012
Jenkins tool to remove old builds from queues so that only the latest commit gets run
View jenkins_queue_optimizer.rb
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 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
joakimk / research.md
Last active May 12, 2017
Research: Why is single Elixir unit tests slow to run?
View research.md

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 Jul 15, 2013
How to find schenker status for a hobbyking netherlands package via GLS.
View gist:5999653
http://privpakportal.schenker.nu/TrackAndTrace/packageinfo.aspx?packagesurrid=69682901&inpPackageId=<SSCC NO>
@joakimk
joakimk / graphite.rb
Created Jan 25, 2012
Graphite client for ruby with specs
View graphite.rb
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 Mar 30, 2012
Jenkins CI continous deployment
View post.md

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 Mar 31, 2012
Notes on how to successfully run faye in a rails app using thin behind a https / SSL nginx proxy with basic auth
View config.ru
require 'faye'
Faye::WebSocket.load_adapter('thin')
use Faye::RackAdapter, :mount => '/faye', :timeout => 25
require ::File.expand_path('../config/environment', __FILE__)
run App::Application
@joakimk
joakimk / controller.rb
Created Feb 17, 2012
A way to lazy load partials in Rails 3
View controller.rb
class Controller
include LazyLoad
def show
@model = Model.find(...)
respond_to do |format|
format.html do
@html_specific_data = Model.find(...)
end
@joakimk
joakimk / talks_and_articles.md
Last active Oct 6, 2016
A collection of good talks and articles by topic. Elixir, Elm, Ruby, ...
View talks_and_articles.md

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

Elm

@joakimk
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)
You can’t perform that action at this time.