Skip to content

Instantly share code, notes, and snippets.

@abierbaum
abierbaum / machine.js
Last active August 12, 2019 20:00
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'server',
initial: 'idle',
context: {
reason: '',
message: '',
token: '',
},
states: {
@abierbaum
abierbaum / machine.js
Last active August 12, 2019 13:22
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine(
{
id: 'ws_machine',
initial: 'disconnected',
strict: true,
context: {
retries: 0,
},
states: {
@abierbaum
abierbaum / machine.js
Created August 11, 2019 20:39
Generated by XState Viz: https://xstate.js.org/viz
// Missing a reconnect
const countdown = Machine({
id: 'count_down',
initial: 'idle',
states: {
idle: {
on: {
START: 'running'
@abierbaum
abierbaum / machine.js
Created August 11, 2019 20:35
Generated by XState Viz: https://xstate.js.org/viz
// Missing a reconnect
const countdown = Machine({
id: 'count_down',
initial: 'idle',
states: {
idle: {
on: {
START: 'running'
@abierbaum
abierbaum / machine.js
Last active August 11, 2019 20:30
Generated by XState Viz: https://xstate.js.org/viz
// Missing a reconnect
const ws_machine = Machine({
id: 'ws_machine',
initial: 'disconnected',
strict: true,
context: {
retries: 0
},
@abierbaum
abierbaum / tslint.json
Created May 14, 2016 18:49
tslint.json file for bug report
{
"rulesDirectory": [
"node_modules/tslint-eslint-rules/dist/rules",
"node_modules/tslint-microsoft-contrib",
"node_modules/vrsource-tslint-rules/rules"
],
"rules": {
"align": [
true,
"parameters",
execve("/usr/bin/docker", ["/usr/bin/docker", "daemon", "-D", "-H", "fd://"], [/* 5 vars */]) = 0
brk(0) = 0x1826000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff1293e6000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=18948, ...}) = 0
mmap(NULL, 18948, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7ff1293e1000
close(4) = 0
open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 4
read(4, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240l\0\0\0\0\0\0"..., 832) = 832
@abierbaum
abierbaum / 0_reuse_code.js
Last active August 29, 2015 14:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@abierbaum
abierbaum / Gruntfile.js
Last active December 14, 2015 09:29
Demonstrate a potential bug in file array format dest referencing.
module.exports = function(grunt) {
// -- LOAD GRUNT PLUGINS -- //
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerMultiTask('debug_files', 'debugs files passed in',
function() {
grunt.log.writeln('Inside task: ' + this.nameArgs);
try {
@abierbaum
abierbaum / bad_browser.html
Created November 6, 2012 15:01 — forked from my8bird/gist:3959405
Chrome Frame example
<!DOCTYPE html>
<html>
<head>
<script >
// Check that we have a supported browser
(function() {
var ua = window.navigator.userAgent,
in_chrome = /chrome/i.test(ua),
in_chrome_frame = /chromeframe/i.test(ua), // Notice inChrome is true if inChromeFrame is
in_ie = /msie/i.test(ua),