Skip to content

Instantly share code, notes, and snippets.


Aleksey Kulikov alekseykulikov

Block or report user

Report or block alekseykulikov

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
View diff2textv1.js
// Translates a Google diff-match-patch diff to an array of ottypes textv1 ops
// Pretty straight-forward!
module.exports = function (diff) {
var ops = [];
for(var i = 0; i < diff.length; i++) {
var diffComp = diff[i];
switch(diffComp[0]) {
case -1: // DELETION
angus-c / advice.js
Created Jun 3, 2012
an advice functional mixin
View advice.js
//mixin augments target object with around, before and after methods
//method is the base method, advice is the augmenting function
withAdvice: function() {
['before', 'after', 'around'].forEach(function(m) {
this[m] = function(method, advice) {
if (typeof this[method] == 'function') {
return this[method] = fn[m](this[method], advice);
ekryski / circle.yml
Last active May 24, 2017
Using Yarn with CircleCI and Heroku
View circle.yml
- mkdir ~/.yarn-cache
version: stable
- curl -o- -L | bash
- ~/.yarn-cache
rauchg /
Last active Jun 19, 2017
Writing ES6 today, effectively.

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.

The main tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on:

kof /
Last active Jul 3, 2017
External things that keep me motivated at work
  1. Open Source being officially part of the job, not just an "after job fun" instead of spending time with the family.
  2. Colleagues one can learn from, not those one needs to clean up after.
  3. Money matters. Only a stupid person can think that money doesn't matter in our capitalistic society. This also includes social security, medical ensurance and any other expenses. I am not mercantile, no.
  4. Soft deadlines. Having time to do things right.
  5. No pressure in being at time every day in the office. We all got our issues.
  6. Workout during working hours. Possibility to go quickly for a run or to the gym.
  7. Office is optional. I prefer to work from any location I want. Sometimes being in the office is nice though.
  8. Good sitting conditions: good chairs, gym ball, stay desk, sofas.
  9. Relaxation room or nap room.


Static files and 404 pages.

{{ mkdir "build" }}
{{ copy "static/*" "build" }}
{{ render "404" | write "build/404.html" }}
matthewmueller / index.html
Last active Jan 11, 2018
HTML Starter Template for rock-solid Web Apps
View index.html
HTML Starter Template for rock-solid Web Apps
Get the latest template here:
rweald / simple-linear-regression.rb
Created Aug 29, 2012
Simple Linear Regression in Ruby
View simple-linear-regression.rb
class SimpleLinearRegression
def initialize(xs, ys)
@xs, @ys = xs, ys
if @xs.length != @ys.length
raise "Unbalanced data. xs need to be same length as ys"
def y_intercept
mean(@ys) - (slope * mean(@xs))

The Story of NPM and Yarn

In the beginning there was NPM, and for a time it was good. Packages went forth and multiplied. The New Gods proclaimed the great demon Dependency Management had been slain. But The Old Gods knew better, for they had seen much and knew that the demon can never be killed, only held at bay.

The Old Gods were ignored. In the folly of a young age grew an abundance of packages and with them grew the scourge of dependency. In the depths beneath the earth, in a place beyond memory, the great demon stirred.

The first sign something was wrong was non-deterministic package version mismatches. “This is fine!” The New Gods declared. “A temporary setback, nothing more! We can fix it.” And so they introduced shrinkwrap, a lamp to combat the growing darkness.

But it proved to be too little, too late, and dusk continued to fall. The New Gods suffered their first major defeat at the [Battle of Left-pad](


Avoid live "then()-ables"

Like a Promise, await will call any .then() function on its operand. This can be used to create values that change every time they are awaited.

let lastId = 1;
const id = {
  then(fn, errfn) {
You can’t perform that action at this time.