Skip to content

Instantly share code, notes, and snippets.

View h-jennings's full-sized avatar

Hunter Jennings h-jennings

View GitHub Profile
Powered*
powerFail -> Unpowered
Green*
tick -> Yellow
Yellow
tick -> Red
Red
tick -> Green
Unpowered
@h-jennings
h-jennings / machine.js
Created December 30, 2019 16:56
Generated by XState Viz: https://xstate.js.org/viz
const dataCollectionStates = {
id: 'dataCollectionStates',
initial: 'idle',
states: {
idle: {
on: {
CHANGE: {
target: 'idle',
actions: ['updateValue'],
},
@h-jennings
h-jennings / sliderMachine.js
Last active November 7, 2019 21:09
Generated by XState Viz: https://xstate.js.org/viz
const sliderMachine = new Machine({
id: 'sliderMachine',
initial: 'idle',
context: {},
states: {
idle:{
on: {
CLICK_RIGHT: {
target: 'nextSlide'
},
@h-jennings
h-jennings / machine.js
Created November 5, 2019 03:48
Generated by XState Viz: https://xstate.js.org/viz
const allData = new Array(25).fill(0).map((_val, i) => i + 1);
const perPage = 10;
const dataMachine = new Machine({
id: 'dataMachine',
initial: 'loading',
context: {
data: [],
},
@h-jennings
h-jennings / booksToScrape.js
Last active September 27, 2019 12:53
Scraping all product headlines from a site
const jsdom = require('jsdom');
const {
JSDOM
} = jsdom;
const Nightmare = require('nightmare');
const nightmare = Nightmare();
const url = 'http://books.toscrape.com/';
// Grabbing the homepage html