Skip to content

Instantly share code, notes, and snippets.

View alexilyaev's full-sized avatar

Alex Ilyaev alexilyaev

View GitHub Profile
@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 / 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 / . 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 / 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 / deploy-ci.sh
Last active May 19, 2020 16:55
Git CI authentication with SSH keys
#!/usr/bin/env bash
# References:
# https://docs.travis-ci.com/user/environment-variables
#
# Inspired by:
# https://gist.github.com/willprice/e07efd73fb7f13f917ea
# But using SSH keys instead of Personal Access Token:
# https://gist.github.com/alexilyaev/2672fe6d99756377fbffaabad6db1f45
@alexilyaev
alexilyaev / eslint-no-null.md
Last active March 4, 2021 21:41
ESLint `no-null` rule from `eslint-plugin-unicorn`
@alexilyaev
alexilyaev / date-fns-issues.md
Last active October 31, 2023 19:19
Moment.js deprecated, date-fns issues
@alexilyaev
alexilyaev / user-settings.json
Last active May 8, 2022 14:06
VS Code Common Settings
{
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
@alexilyaev
alexilyaev / react-folder-structure-ideas.md
Last active December 10, 2020 12:16
React Folder Structure Ideas

React Folder Structure Ideas

Suggested structure

components/
  NavBar/
    BrandLogo.jsx
    NavBar.jsx
 NavBar.text.jsx