This is a SCRIPT-8 cassette.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fixup | |
| set -lx current_branch (git rev-parse --abbrev-ref HEAD) | |
| set -lx commits (git log --oneline $current_branch...origin/master)[-1..1] | |
| set -lx len (count $commits) | |
| printf "Fixup: Which commit would you like to fixup? \n\n" | |
| for i in (seq $len) | |
| printf "$i) $commits[$i]\n" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function nand | |
| set -lx nand_path "/Users/duncan/projects/nand2tetris/tools" | |
| set -lx programs (ls $nand_path | rg "sh") | |
| printf "Nand2Tetris: Which Program would you like to run? \n\n" | |
| set -lx len (count $programs) | |
| for i in (seq (count $programs)) | |
| printf "$i) $programs[$i]\n" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import styled from 'styled-components'; | |
| const createGetPosition = end => index => { | |
| if (index === 0) { | |
| return 'flex-start' | |
| } else if (index === end) { | |
| return 'flex-end' | |
| } else { | |
| return 'center' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| validate = (value) => _validate(transform(value)) | |
| ^^^^^^^^^^^^^^^^ function call. Function cannot be called on possibly undefined value | |
| validate = (value) => _validate(transform(value)) | |
| ^^^^^^^^^ undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export type Dict<K, V> = { | |
| [key: K]: V | |
| }; | |
| export type Field = {| | |
| type: 'field', | |
| iterable: boolean, | |
| name: string, | |
| nested: boolean, | |
| path: string | void, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * The range utility works like the range included in Python 3. It either takes: | |
| * - a single number representing the stop value (implicitly starting at 0) | |
| * - 2 numbers representing the start and stop values | |
| * - 3 numbers representing the start, stop, and step values | |
| * | |
| * @see https://docs.python.org/3/library/stdtypes.html#range | |
| * | |
| * @param {number} [start=0] - Starting number of the sequence (0 by default) | |
| * @param {number} stop - Generate up to but not including this number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * I add this to html files generated with pandoc. | |
| */ | |
| html { | |
| font-size: 100%; | |
| overflow-y: scroll; | |
| -webkit-text-size-adjust: 100%; | |
| -ms-text-size-adjust: 100%; | |
| } |
- Service workers are about giving web sites more abilities in order to operate like apps
- Big features of service workers: proxying requests / caching, receiving push notifications
- wrt. caching, most online tutorials focus solely on this feature. We won't spend time on it beyond a high level overview of how it works and why it's different from browser caching (diagram of how sw can intercept fetch requests. Could even demo)
- The more interesting feature is the ability to register for and receive push notifications, even when the page is closed
- Push notifictions can allow the app to update behind the scenes
- Do you stash the new data in IndexedDB and on initialization of the page send a message? Or can we do something different?
- Can we put the application store in the service worker?
- Intro to sw-redux https://github.com/adregan/sw-redux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const range = (start = 0, end = undefined, skip = 1) => { | |
| if (!end) [end, start] = [start, 0]; | |
| if (start >= end) return []; | |
| return { | |
| [Symbol.iterator]: function* () { | |
| yield start; | |
| while (start < end - skip) yield start += skip; | |
| }, | |
| toArray () { |