Skip to content

Instantly share code, notes, and snippets.

View mikeerickson's full-sized avatar

Mike Erickson mikeerickson

View GitHub Profile
@mikeerickson
mikeerickson / update-package.js
Created November 18, 2022 17:25
update package.json
#!/usr/bin/env node
const fs = require('fs');
const messenger = require('@codedungeon/messenger');
try {
// read package.json as object
const pkgJsonData = JSON.parse(fs.readFileSync('./package.json', 'utf-8'));
// add lint script
@mikeerickson
mikeerickson / sold-eslintrc.js
Created November 17, 2022 23:30
soldcom eslint master
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
},
plugins: ['@typescript-eslint'],
root: true,
rules: {
'no-unused-vars': 'off',
@mikeerickson
mikeerickson / lint.js
Last active November 17, 2022 23:38
script to execute linter and use pretty output
#!/usr/bin/env node
const execa = require('execa');
const msg = require('@codedungeon/messenger');
const findMatches = (str = '', findStr = '') => {
const re = new RegExp(findStr, 'g');
return str.match(re);
};
@mikeerickson
mikeerickson / gist:15040aa766426513a506341b8c1fecce
Last active April 29, 2022 19:57
NotePlan DayNumber Workaround
<% const today = date.now('YYYY-MM-DD') %>
<%- date.dayNumber(`${today}`) %>
module.exports = {
accepted: "必須接受 :attribute。",
after: ":attribute 必須在 :after 之後。",
after_or_equal: ":attribute 必須跟 :after_or_equal 同一天或是在 :after_or_equal 之後。",
alpha: ":attribute 只能包含字母。",
alpha_dash: ":attribute 只能包含字母,連結號(-)和底線(_)。",
alpha_num: ":attribute 只能包含字母和數字。",
alpha_numeric: ":attribute 只能包含字母和數字。",
array: "The :attribute must be an array",
before: ":attribute 必須在 :before 之前。",
@mikeerickson
mikeerickson / CONTRIBUTING.md
Created January 18, 2019 20:52
Contirbuting Guidelines

Commit Subjects

If your patch changes the API or fixes a bug please use one of the following prefixes in your commit subject:

  • [fixed] ...
  • [changed] ...
  • [added] ...
  • [removed] ...
@mikeerickson
mikeerickson / stress-test.sh
Last active January 3, 2019 22:25
(SH) Script to execute mocha test stress tests
#!/bin/bash
ESC_SEQ="\x1b["
COL_RESET=${ESC_SEQ}"39;49;00m"
COL_BLUE=${ESC_SEQ}"34;01m"
COL_GREEN=${ESC_SEQ}"32;01m"
COL_CYAN=${ESC_SEQ}"36;01m"
ITERATIONS=${1:-5}
@mikeerickson
mikeerickson / stress-test.js
Last active January 3, 2019 22:26
(JS) Script to execute mocha test stress tests
/*eslint no-console: "off"*/
const { spawnSync } = require("child_process");
const colors = require("chalk");
let iterations = process.argv.slice(2)[0] || 5;
console.log("");
console.time(colors.red("Execution Time"));
for (let idx = 1; idx <= iterations; idx++) {
@mikeerickson
mikeerickson / README.md
Last active November 23, 2018 18:18
Install JS Dev Tools

Install JS Developer Tools

Installs common development tools that I like to use in each project

Installation

  1. Make sure project has been initialized with npm init
  2. Execute npx command