Skip to content

Instantly share code, notes, and snippets.

@mikrofusion
mikrofusion / continuous_integration_consistency.md
Last active August 29, 2015 14:05
A proposal for continuous integration and deployement while maintaining business consistency

Release to acceptance every day. Release to production every week.

Assumptions:

  • Hotfixes to production should be rare and should be reserved for critical fixes impacting the business.
  • If the release cycle is longer than a week, it becomes harder for the business to be OK waiting for fixes. This leads to too many fixes then becoming hotfixes.
  • By releasing once a week you increase the probability that critical fixes can wait a few days and grab a seat on the release train.
  • Bugs will get introduced as code changes. If the release cycle is longer than a week, then too many features and fixes will go into the release before it gets QA'ed / goes to production. This increases the chances of bugs sneaking through to production.

Cut a release branch on Monday. QA release through the week. Release that branch on Thursday.

@mikrofusion
mikrofusion / es6curry.js
Created August 17, 2015 23:19
Currying in ES6
// Small example to show how ES6 allows for elegant currying
function mult() {
return val1 => val2 => val1 * val2;
}
var times2 = mult(2);
times2(7); // returns 14
@mikrofusion
mikrofusion / left-pad
Created March 28, 2016 23:16
left-pad
module.exports = leftpad;
function leftpad (str, len, ch) {
str = String(str);
var i = -1;
if (!ch && ch !== 0) ch = ' ';
len = len - str.length;
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
defmodule Api.ResourceCreateSpec do
use ESpec, async: false
import Api.Factory
@authority "localhost:#{Application.get_env(:api, Api.Endpoint)[:http][:port]}"
@schema build(:schema)
before do
Api.Repo.delete_all(Api.Resource)
Api.Repo.delete_all(Api.ResourceData)