Skip to content

Instantly share code, notes, and snippets.

@pke
pke / machine.js
Created January 31, 2020 00:35
Generated by XState Viz: https://xstate.js.org/viz
const setStatus = assign((context, event, meta) => ({
statusCode: meta.statusCode,
statusText: meta.statusText,
}))
const fetchMachine = Machine({
id: 'http-request',
initial: 'start',
context: {
statusCode: 0,
@pke
pke / README.md
Created January 29, 2020 12:55 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@pke
pke / gist:50ff98187b4f10f960dc11caffc14632
Created January 29, 2020 12:53 — forked from philfreo/gist:7257723
Facebook Perl source code from 2005. When browsing around thefacebook.com in 2005 the server spit out some server-side source code rather than running it. I believe this was for their old graph feature that let you visualize the graph between all your friends. The filename is `mygraph.svgz` and contains some gems such as a commented out "zuck" d…
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
@pke
pke / machine.js
Last active November 27, 2019 02:01
Generated by XState Viz: https://xstate.js.org/viz
const guards = {
canCountDown: context => !guards.countedDown(context),
countedDown: context => context.count === 0
}
const _actions = {
startCounting: assign({ startCount: context => context.count }),
reset: assign({ count: context => context.startCount }),
countdown: assign({ count: context => context.count - 1 })
}
@pke
pke / machine.js
Last active November 26, 2019 19:49
Generated by XState Viz: https://xstate.js.org/viz
const HEAT_CAPACITY_OF_WATER = 4180
const heatingDuration = ({
power,
efficiency,
milliliter,
waterTemp,
targetTemp = 100
}) => {
const effectivePower = power * (efficiency * 0.01)
@pke
pke / machine.js
Last active November 19, 2019 22:35
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@pke
pke / machine.js
Created November 10, 2019 22:04
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
initial: 'idle',
states: {
idle: {
on: { FETCH: 'loading' }
},
loading: {
after: {
3000: 'failure.timeout'
@pke
pke / machine.js
Last active November 10, 2019 22:03
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
initial: 'idle',
states: {
idle: {
on: { FETCH: 'loading' }
},
loading: {
after: {
3000: 'failure.timeout'
@pke
pke / machine.js
Last active November 20, 2019 07:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
{
"basics": {
"name": "Philipp Kursawe",
"email": "phil.kursawe@gmail.com",
"phone": "+49-179-4693549",
"label": "Software Architect",
"summary": "Ship bug-free, tested, small functional code that uses the resources of the target system carefully.\nFavour convention over configuration.",
"location": {
"city": "Cologne"
},