Skip to content

Instantly share code, notes, and snippets.

View kossnocorp's full-sized avatar
Shipping

Sasha Koss kossnocorp

Shipping
View GitHub Profile
@kossnocorp
kossnocorp / date-fns-perf.log
Created December 7, 2016 21:13
Preview of date-fns performance tests (I don't have more because of a typo in code)
addDays: date-fns at 4669306 ops/sec (9.84x faster than Moment.js)
addHours: date-fns at 4434109 ops/sec (4.99x faster than Moment.js)
addISOYears: date-fns had no peers for comparison at 38962 ops/sec
addMilliseconds: date-fns at 4316611 ops/sec (4.86x faster than Moment.js)
addMinutes: date-fns at 4409582 ops/sec (5.07x faster than Moment.js)
addMonths: Moment.js at 249379 ops/sec (1.71x faster than date-fns)
addQuarters: Moment.js at 242896 ops/sec (1.30x faster than date-fns)
addSeconds: date-fns at 4383032 ops/sec (5.10x faster than Moment.js)
addWeeks: date-fns at 4278915 ops/sec (10.54x faster than Moment.js)
addYears: Moment.js at 318328 ops/sec (1.41x faster than date-fns)
// When shrinkwrap is used npm install won't update git dependencies.
// The hack removes outdated dependencies.
//
// See https://github.com/npm/npm/issues/12718 for more details about the bug.
const path = require('path')
const fs = require('fs')
const {spawn} = require('child_process')
let shrinkwrapJSON

Reverse

Write string reverse function using recursion.

module Reverse (..) where
import Html exposing (Html, text)
import String
reverse : List Char -> List Char
reverse str =
case str of
[] ->
@kossnocorp
kossnocorp / 1.md
Created September 29, 2015 04:37
Problem with semicolons

Given code:

const bowerJSONPath = path.join(process.cwd(), 'bower.json')
const packageJSONPath = path.join(process.cwd(), 'package.json')

[bowerJSONPath, packageJSONPath].forEach((packagePath) => {/* */})

… generates such output:

@kossnocorp
kossnocorp / 1.md
Last active September 26, 2015 02:38
Power Assert with HTMLElement

var noLocationStr = function(origin) {
return !!origin.get('location_str');
};
var withStatus = function(foreignKey, statuses, origin) {
return origin
.set('status', statuses.find(s => s.get(foreignKey) == origin.get('id')));
};
var withLocation = function(locations, locationStr, origin) {
var csp = require('js-csp');
var Github = require('./github');
var GoogleMaps = require('./google_maps');
var TEAM = process.env.GITHUB_TEAM;
csp.go(function*() {
var team = yield csp.take(Github.getTeamMembers(TEAM));
for (var i = 0; i < team.length; i++) {

Intallation

wget https://gist.github.com/kossnocorp/ece8c568a08de6fbff95/raw/b041a023d0114ef11ba9c2b568510c37f4c19918/TODO.js
npm install date-fns string-fns chalk commander
brew install ag

Usage