Skip to content

Instantly share code, notes, and snippets.

View tomraithel's full-sized avatar
🏠
Working from home

Tom Raithel tomraithel

🏠
Working from home
View GitHub Profile
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@tomraithel
tomraithel / machine.js
Last active January 15, 2021 10:00
Generated by XState Viz: https://xstate.js.org/viz
const loggedInState = {
initial: 'idle',
states: {
idle: {
on: {
load: 'loading'
}
},
loading: {
invoke: {
@tomraithel
tomraithel / machine.js
Last active February 27, 2020 06:36
FlightSelection xState config
const wizardStates = {
initial: "date",
states: {
date: {
on: {
NEXT: "flight"
}
},
flight: {
on: {
@tomraithel
tomraithel / munchkin-statechart.js
Last active April 10, 2019 20:40
Statechart for munchkin rules
// Copy-Paste this Chart into the visualizer: https://statecharts.github.io/xstate-viz/
// Available variables:
// Machine (machine factory function)
// XState (all XState exports)
const { assign } = XState.actions;
const fightStates = {
initial: "fightOrRun",
@tomraithel
tomraithel / recover-lost-git-files.sh
Created August 10, 2018 20:30
Recover from `git reset --hard` before any initial commit has been made
#!/bin/bash
# This script helps to restore important files after someone acidentially
# ran `git reset --hard` before any commit have been made. `git reflog`
# can´t help you in such cases, because it needs at least one commit
# You can only restore files via this approach, if the files have been
# added with `git add` before the reset was executed! If that was not the
# case, then I have bad news for you: This won´t work :(
@tomraithel
tomraithel / README.md
Last active April 26, 2018 10:57
Vorschlag: Component Folder Pattern CoP Frontend

Vorschlag für Componenten-Struktur

Stand: Aktuell

radio
├── Radio.jsx
├── Radio.scss
├── RadioSpec.jsx
@tomraithel
tomraithel / showDataQa.js
Created January 19, 2018 10:43
Snippet to display data-qa attributes on a site
const cssText = `
[data-qa] {
outline: 1px solid #E91E63 !important;
}
[data-qa]:hover {
outline: 2px solid #E91E63 !important;
}
[data-qa]:hover:before {
display: block;
white-space: nowrap;
@tomraithel
tomraithel / guide.md
Last active July 16, 2018 08:18
New Mac Installation

Install homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install iterm2 and zsh

See https://gist.github.com/kevin-smets/8568070

Setup new SSH key

A good guide from github is here

@tomraithel
tomraithel / code-review
Last active August 2, 2017 11:52 — forked from evant/code-review
A ruby script to automatically create crucible reviews
#!/usr/bin/env ruby
# A script to create a review on crucible based on the current git branch
#
# To configure settings, create a file named .code-review in your home directory
# The format should be:
# ------------------------------------------------------------------------------
# crucible:
# url: <crucible url>
# username: <username>
# password: <password>
@tomraithel
tomraithel / extract-glyphs.py
Created October 25, 2016 14:29
Create svg files from an icon-font
import sys
if len(sys.argv) < 2:
print 'Usage: python {} webfont-file.svg'.format(sys.argv[0])
sys.exit()
with open(sys.argv[1], 'r') as r:
lines = r.read().split('\n')
glyphs = [x for x in lines if '<glyph' in x]
# for every glyph element in the file
for i in range(0, len(glyphs)):