Skip to content

Instantly share code, notes, and snippets.


Alex Ilyaev alexilyaev

View GitHub Profile
alexilyaev /
Last active Sep 25, 2020
What to do now that Moment.js is considered a legacy project?
alexilyaev /
Last active Mar 4, 2021
ESLint `no-null` rule from `eslint-plugin-unicorn`
alexilyaev /
Last active May 19, 2020
Git CI authentication with SSH keys
#!/usr/bin/env bash
# References:
# Inspired by:
# But using SSH keys instead of Personal Access Token:
alexilyaev /
Last active May 11, 2020
Summary of the new stuff in Next.js 9.3

The blog post on Next.js 9.3

export async getStaticProps

  • Runs at build time only, meaning if there’s no getInitialProps, the page will be served as a static file (no SSR).
  • Can pass data to the page component as props.
  • In development runs on every request

export async getStaticPaths

alexilyaev / .
Last active Jul 11, 2021
Setup ESLint with Prettier
View .

ESLint with Prettier Setup

Basically, when using Prettier, all ESLint styling rules should be disabled.
This can be done with eslint-config-prettier.

See .eslintrc.js example below.
In prettier.config.js you can use anything you want (see example below).

Now the tricky part is how to run them...
Usually ESLint should run first, then Prettier.

alexilyaev / time-to-decimal.js
Created Dec 6, 2018
Alfred Worflow - Time To Decimal
View time-to-decimal.js
* Convert a time string to a decimal value
* @param {string} argv e.g. 142h13m, 142 h 13 min
function run(argv) {
const query = argv[0];
const [, hours, minutes] = query.match(/\s*(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?/)
let decimal = 0;
alexilyaev / license-checker.js
Created Nov 19, 2017
A small script to check packages installed through npm against a whitelist of licenses and packages
View license-checker.js
'use strict';
const _ = require('lodash');
const winston = require('winston');
const checker = require('license-checker');
const chalk = require('chalk');
const licensesWeAreOKWith = `
View canvas-ping-pong.markdown
View index.html
<svg width="500" height="300" viewBox="0 0 500 300">
<!-- Define components -->
<g id="tape">
<rect width="450" height="200" fill="#222"
stroke="#aaa" stroke-width="5"/>
<g id="wheel">
<circle cx="50" cy="50" r="50"
alexilyaev / .hyper.js
Last active Jul 31, 2017
Hyper.js configuration
View .hyper.js
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 16,
// font family with optional fallbacks
fontFamily: '"Fira Code", Monaco, Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248, 28, 229, 0.8)',