Skip to content

Instantly share code, notes, and snippets.

View karfau's full-sized avatar
🎯
Focusing

Christian Bewernitz karfau

🎯
Focusing
  • bettermarks GmbH
  • Saxony / Germany
  • 20:21 (UTC +02:00)
View GitHub Profile
@karfau
karfau / npm-ls-ratio.sh
Created May 3, 2020 10:10
npm-ls-ratio
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
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@karfau
karfau / Unsupported.md
Last active November 26, 2020 10:23
Unsupported browser user agents
@karfau
karfau / nvm-install
Last active March 28, 2024 09:16
A script that can be sourced in shell scripts to enable nvm support
# 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
# Sometimes we prefer `nvm use` over `nvm install`
# you can basically put anything you want here, but the default is `install`
@karfau
karfau / functional.spec.ts
Last active December 11, 2020 09:43
some cypress example
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 / machine.js
Created February 2, 2021 20:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@karfau
karfau / machine.js
Last active May 28, 2021 06:26
Generated by XState Viz: https://xstate.js.org/viz
const formField = Machine({
id: 'formField',
initial: 'clean',
context: {
initialValue: '',
value: '',
feedback: undefined,
pending: false,
@karfau
karfau / checks-trap-or-verbose.sh
Last active January 24, 2022 07:29
Bash status checks with option to switch between "print every line" and "only print last failed"
#!/usr/bin/env bash
## these comments explain what happens in the next line(s)
# set options explained, source https://wiki.bash-hackers.org/commands/builtin/set
# -e errexit
# When set, the shell exits when a simple command in a command list exits non-zero (FALSE).
# This is not done in situations, where the exit code is already checked (if, while, until, ||, &&)
# -E errtrace
# ERR-traps are inherited by by shell functions, command substitutions, and commands executed in a subshell environment.
# -T functrace
# DEBUG- and RETURN-traps are inherited by subsequent environments, like -E for ERR trap.