Skip to content

Instantly share code, notes, and snippets.

View mgechev's full-sized avatar
👷‍♂️
Making web development easier

Minko Gechev mgechev

👷‍♂️
Making web development easier
View GitHub Profile
const { readFileSync, writeFileSync } = require('fs');
const re = /\[.*?\](\(.*?\))/g
const addFootnotes = (path, output, ignoreRegExps = []) => {
let text = readFileSync(path).toString();
let match;
let current = 1;
const matches = [];
https://stackblitz.com/edit/angular-rqhkxt?file=app%2Fapp.component.ts
{
"title": "Accessories",
"url": "https://www.amazon.com/s/ref=lp_502394_nr_n_0?fst=as%3Aoff&rh=n%3A172282%2Cn%3A%21493964%2Cn%3A502394%2Cn%3A172435&bbn=502394&ie=UTF8&qid=1497468310&rnid=502394",
"subCategories": [
{
"title": "Accessory Bundles",
"url": "https://www.amazon.com/s/ref=lp_172435_nr_n_0/144-8642642-1755349?fst=as%3Aoff&rh=n%3A172282%2Cn%3A%21493964%2Cn%3A502394%2Cn%3A172435%2Cn%3A7242007011&bbn=172435&ie=UTF8&qid=1497479054&rnid=172435",
"products": [
{
"title": "58MM Professional Lens Filter Accessory Kit (Vivitar Filter Kit (UV, CPL, FLD) + Carry Pouch + Tulip Lens Hood + Snap-On Lens Cap w/ Cap Keeper Leash + MagicFiber Microfiber Lens Cleaning Cloth)",
@mgechev
mgechev / bundle.lazy.ts
Last active June 12, 2018 09:10
Lazy loading in Angular Seed
import { appendFileSync } from 'fs';
import { join } from 'path';
import * as utils from 'gulp-util';
import * as Builder from 'systemjs-builder';
import Config from '../../config';
const BUNDLER_OPTIONS = {
format: 'cjs',
minify: true,
/* tslint:disable */
const program =
`
module "login"
go to "app/login"
fill "mgechev+18@gmail.com" in "#username"
fill "foobar" in "#password"
click "#login"
@mgechev
mgechev / ng2lint.md
Last active February 19, 2016 10:02

Grammar

EBNF

program = statement+
statement = expression | if_statement
if_statement = 'if' '(' expression ')' { statement+ }
expression = number (+ expression)*
@mgechev
mgechev / promise-monad-proof.js
Created November 12, 2015 07:39 — forked from briancavalier/promise-monad-proof.js
A proof that Promises/A is a Monad
//-------------------------------------------------------------
//
// Hypothesis:
//
// Promises/A is a Monad
//
// To be a Monad, it must provide at least:
// - A unit (aka return or mreturn) operation that creates a corresponding
// monadic value from a non-monadic value.
// - A bind operation that applies a function to a monadic value
@mgechev
mgechev / qs.clj
Last active November 13, 2015 05:59
Quick sort with ECMAScript array comprehensions
(defn qs [lst]
(let [[head & tail] lst]
(if (>= 1 (count lst))
lst
(flatten [(qs (for [x tail :when (<= x head)] x)) head (qs (for [x tail :when (> x head)] x))]))))

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Tue, 11 Mar 2014 00:00:46 GMT till Wed, 11 Mar 2015 00:00:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 373)

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: