Skip to content

Instantly share code, notes, and snippets.

View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@karfau
karfau / functional.spec.ts
Last active Dec 11, 2020
some cypress example
View functional.spec.ts
describe("Basic flow control in Cypress", () => {
before(() => {
cy.window().then(window => {
window.document.write(`
<ul>
<li>
<a>1a</a>
<a>1b</a>
</li>
<li>
@karfau
karfau / nvm-install
Last active Dec 3, 2020
A script that can be sourced in shell scripts to enable nvm support
View nvm-install
# shellcheck shell=sh
# https://gist.github.com/karfau/dcf98c6eefc2f2132c160f5c14d2112f
# needs to be sourced as part of your script
# 1. tries to configure nvm and run `nvm install`
# 2. checks if the node version is correct based on ./.nvmrc (`v` prefix not supported)
# if both doesn't work, exits with code 1 and some helpful messages
# https://unix.stackexchange.com/a/184512/194420
# https://github.com/nvm-sh/nvm/issues/1290
@karfau
karfau / Unsupported.md
Last active Nov 26, 2020
Unsupported browser user agents
View Unsupported.md
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View npm-ls-ratio.sh
git pull
nvm i
npm ci
npm ls --parseable --depth 0 | wc -l
npm ls --parseable | wc -l
npm ls --parseable --depth 0 --production | wc -l
npm ls --parseable --production | wc -l
@karfau
karfau / ormconfig.register.js
Last active Dec 8, 2019
workaround for typeorm no longer loading ormconfig.env by default
View ormconfig.register.js
// Source: https://gist.github.com/karfau/b6d0927628f6662ca6d892153562522f
// 1. copy this file to your root directory alongside ormconfig.env
// in your package.json scripts/mocha.opts, etc add
// --reqister ./ormconfig.register.js
// or
// -r ./ormconfig.register.js
const {config} = require('dotenv');
const path = require('path');
config({path: path.join(__dirname, 'ormconfig.env')});
@karfau
karfau / .extend.docker.bashrc
Last active Jun 19, 2020
Aliases for docker and docker-compose alongside podman
View .extend.docker.bashrc
# With my local setup in Manjaro I'm using https://podman.io/ as a rootless docker replacement:
# https://podman.io/getting-started/installation#arch-linux--manjaro-linux
# To be able to still run the real docker when required, but use podman by default I added this link:
# /usr/local/bin/docker -> /usr/bin/podman
# I wanted to have an easy way to switch to real docker and back so I created the following aliases:
# <name>su switches on <name>, un<name> switches off <name>
# since the tools all require docker daemon to run and calling 'sudo <name>',
# but most scripts assume it works wihtout sudo
# docker