Skip to content

Instantly share code, notes, and snippets.

View alexilyaev's full-sized avatar

Alex Ilyaev alexilyaev

View GitHub Profile
@alexilyaev
alexilyaev / Next.js-9.3.md
Last active May 11, 2020 21:25
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
alexilyaev / . README.md
Last active May 18, 2022 15:16
Setup ESLint with Prettier

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
alexilyaev / time-to-decimal.js
Created December 6, 2018 11:09
Alfred Worflow - Time To Decimal
/**
* 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
alexilyaev / license-checker.js
Created November 19, 2017 13:03
A small script to check packages installed through npm against a whitelist of licenses and packages
'use strict';
const _ = require('lodash');
const winston = require('winston');
const checker = require('license-checker');
const chalk = require('chalk');
const licensesWeAreOKWith = `
MIT,
MIT*,
@alexilyaev
alexilyaev / canvas-ping-pong.markdown
Created November 16, 2017 15:13
Canvas - Ping Pong
@alexilyaev
alexilyaev / index.html
Created November 16, 2017 15:12
SVG Tape
<svg width="500" height="300" viewBox="0 0 500 300">
<!-- Define components -->
<defs>
<g id="tape">
<rect width="450" height="200" fill="#222"
stroke="#aaa" stroke-width="5"/>
</g>
<g id="wheel">
<circle cx="50" cy="50" r="50"
@alexilyaev
alexilyaev / .hyper.js
Last active July 31, 2017 09:14
Hyper.js configuration
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)',
@alexilyaev
alexilyaev / gh-pages-deploy.md
Created April 30, 2017 12:19 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@alexilyaev
alexilyaev / webstorm-plugins.md
Last active January 4, 2017 13:28
WebStorm Plugins
  • .ignore
  • BashSupport
  • Css Alphabetical Rearranger
  • GFM
  • Markdown Support
  • Presentation Assistant
@alexilyaev
alexilyaev / angular-webpack-guidelines.md
Last active August 29, 2015 14:25
Angular Guidelines when using WebPack

No more IIFE

  • WebPack wraps each requireed code with a function, so there's no need to wrap our code with an IIFE
/**
 * Good
 */