Skip to content

Instantly share code, notes, and snippets.

@bmartel
bmartel / machine.js
Last active July 28, 2022 18:32
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@bmartel
bmartel / custom-element.ts
Created April 7, 2022 16:46
Simple snippet for creating vanilla web components.
export const define = (
name: string,
ElCtor: CustomElementConstructor,
options?: ElementDefinitionOptions
): void => {
if (typeof window !== 'undefined') {
customElements.define(name, ElCtor, options)
}
}
@bmartel
bmartel / pkglist.txt
Created December 18, 2020 19:27
arch sys pkg's
alsa-plugins
alsa-utils
arandr
autoconf
autofs
automake
base
bash-completion
binutils
bison
#!/bin/bash
# Setup arch
pacman -S --noconfirm pacman-contrib curl
# Setup Mirrors
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
curl "https://www.archlinux.org/mirrorlist/?country=CA&country=US&protocol=http&protocol=https&ip_version=4" -o /etc/pacman.d/mirrorlist.new -s
sed -i 's/#S/S/g' /etc/pacman.d/mirrorlist.new
rankmirrors -n 10 /etc/pacman.d/mirrorlist.new > /etc/pacman.d/mirrorlist
# make sure there is no delay in the esacpe sequence
set -g escape-time 10
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
base 2-2
curl 7.70.0-1
docker 1:19.03.11-1
docker-compose 1.25.5-1
e2fsprogs 1.45.6-2
gist 5.1.0-1
git 2.27.0-1
grub 2:2.04-7
haveged 1.9.8-2
inetutils 1.9.4-8
base 2-2
curl 7.70.0-1
docker 1:19.03.11-1
docker-compose 1.25.5-1
e2fsprogs 1.45.6-2
gist 5.1.0-1
git 2.27.0-1
grub 2:2.04-7
haveged 1.9.8-2
inetutils 1.9.4-8
@bmartel
bmartel / cookie.js
Created March 31, 2020 00:26
Simple cookie helper
@bmartel
bmartel / .eslintrc.js
Created November 30, 2019 17:22
eslint + prettier for react like apps
module.exports = {
parser: "babel-eslint",
extends: ["prettier"],
plugins: ["import", "react"],
rules: {
"no-unused-vars": [2, { varsIgnorePattern: "h" }],
"react/jsx-uses-vars": 2,
"no-undef": 0
}
};
@bmartel
bmartel / glitch_vimify.js
Last active November 2, 2019 12:01 — forked from jonchurch/glitch_vimify.js
Vim Bindings for Glitch.com editor
// Load your Glitch project, paste this into the javascript console of chrome inspect
// Enjoy vim goodness!
(function () {
var makeCursorFat = function() {
var style = document.createElement('style');
style.textContent =
'div.CodeMirror div.CodeMirror-cursor { ' +
'width: auto; ' +
'border: 0; ' +