Skip to content

Instantly share code, notes, and snippets.

@alexdunne
alexdunne / machine.js
Created October 21, 2019 14:48
Generated by XState Viz: https://xstate.js.org/viz
const buildFetchingState = (name) => {
const uppercase = name.toUpperCase();
const capitalized = name.charAt(0).toUpperCase() + name.slice(1);
return {
initial: 'idle',
states: {
idle: {
on: {
[`FETCH_${uppercase}`]: 'loading',
@alexdunne
alexdunne / machine.js
Last active September 19, 2019 09:54
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@alexdunne
alexdunne / .gitconfig
Created May 29, 2019 12:21
Git config aliases
[alias]
shorty = status --short --branch
please = push --force-with-lease
merc = merge --no-ff
grog = log --graph --abbrev-commit --decorate --all --format=format:\"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)\"
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
co = checkout
br = branch
ci = commit
st = status
@alexdunne
alexdunne / 01 - Docker sentry.md
Last active October 10, 2017 04:04
Docker sentry

Setting up sentry with docker + docker-compose.

Generate a secret key for sentry to use. Place this in your .env file

docker run --rm sentry config generate-secret-key

Build the sentry service

docker-compose up -d
@alexdunne
alexdunne / device-motion-event.html
Created March 28, 2017 07:44
Listen for DeviceMotionEvents with RxJs. Using jQuery to move an element depending on the acceleration on the Y axis of the DeviceMotionEvent.
<html>
<head>
<style>
#block {
position: absoulte;
background: red;
width: 150px;
height: 500px;
left: calc(50% - 75px);
top: 0px;