Skip to content

Instantly share code, notes, and snippets.

View busterc's full-sized avatar

Buster Collings busterc

View GitHub Profile
@busterc
busterc / NextJS-MUI.md
Last active April 4, 2023 13:03
[NextJS + MUI] like peanut butter and jelly #nextjs #mui #material-ui
@busterc
busterc / NextJS-ESLint-Prettier-Lint-Staged-Husky-VSCode.md
Last active May 23, 2023 18:31
[NextJS with all the Must-Haves] #eslint #prettier #lint-staged #husky #vscode #mui #nextjs

NextJS with ESLint (extends google + prettier) + Prettier + Lint-Staged + Husky (pre-commit hook)

Install and initialize all the necessary dev-dependencies

yarn add --dev prettier eslint-plugin-prettier eslint-config-prettier eslint-config-google lint-staged husky
yarn husky install && husky add .husky/pre-commit "yarn lint-fix"

Prettier Config+Plugin for ESLint

  • Prettier is run as an ESLint Plugin, rather than as a stand-alone tool
@busterc
busterc / README.md
Created July 9, 2019 22:44
[Cordova Live-Server] how to configure a Cordova App to render content from Live-Server #cordova

Cordova Live-Server

how to configure a Cordova App to render content from Live-Server

config.xml

Add elements: content and allow-navigation

@busterc
busterc / README.md
Created October 15, 2018 15:49
[Knex Postgres Timestamps] timestamps with precision for Knex + Postgres migrations #knex #pg #db

knex-pg-timestamps

timestamps with precision for Knex + Postgres migrations

Usage

const {
  addTimestamps, // (knex, table, precision = 3) : Promise
 addFunctionOnUpdateTimestamp, // (knex) : Promise
@busterc
busterc / README.md
Created October 9, 2018 15:56
[always npm run post* using TRAP] when you need to npm run post* after failures #npm #npm-scripts

always npm run post* using trap

just trap it

{
  "scripts": {
    "pretest": "docker-compose up",
    "test": "trap 'npm run posttest && exit 1' ERR ; jest --coverage",
 "posttest": "docker-compose down"
@busterc
busterc / README.md
Created September 1, 2018 15:37
[BAT_PAGER] prevent dumping output to screen on quit #bash #sh

BAT_PAGER

prevent dumping output to screen on quit

  1. Save bat_pager script to $HOME/bin
    #!/usr/bin/env bash
    less -r "$@"
  2. Make it executable:
@busterc
busterc / config
Last active March 5, 2024 10:16
[Fix Slow BitBucket] remove IPv6 from ssh/git for bitbucket.org #git #bitbucket #ssh
# https://bitbucket.org/site/master/issues/8809/cloning-and-pushing-excruciatingly-slow#comment-34263833
Host bitbucket.org
AddressFamily inet
@busterc
busterc / gist:241a5a3e491bc731fb509be4f414b6f2
Last active January 12, 2018 15:29 — forked from elcontraption/gist:4028550
WordPress change domain query #wordpress #sql #config
SET @old_domain = 'http://olddomain.com';
SET @new_domain = 'http://newdomain.com';
UPDATE wp_options SET option_value = replace(option_value, @old_domain, @new_domain) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, @old_domain, @new_domain);
UPDATE wp_posts SET post_content = REPLACE (post_content, @old_domain, @new_domain);
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, @old_domain, @new_domain);
@busterc
busterc / timer.sh
Last active January 12, 2018 15:33
countdown timer for bash #bash
#!/bin/bash
function timer() {
if [[ $1 -lt 1 ]]; then
cat <<EOF
Usage: timer <seconds>
EOF
return 1
@busterc
busterc / stopwatch.sh
Last active January 11, 2020 07:14
stopwatch with laps for bash #bash
#!/bin/bash
function stopwatch() {
local n=0
local t=0
local continuing="true"
local lap=1
local key="~"
local pausing="~"