Skip to content

Instantly share code, notes, and snippets.

Jess Telford jesstelford

Block or report user

Report or block jesstelford

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View machine.js
// Vocal 'publishStatus' state machine
const machineId = 'publishing';
const publishMachine = Machine(
{
id: machineId,
initial: 'draft',
states: {
uninitialized: {
on: {
draft: 'draft',
View machine.js
// Partial representation of old `publishStatus` & `reviewStatus` states in Legacy Vocal.
// See https://xstate.js.org/viz/?gist=6a25309b09bd2a70a9a678ca9ee7fa2b for the latest Replatform version.
const machineId = 'publishing';
const publishMachine = Machine({
id: machineId,
initial: 'draft',
states: {
draft: {
on: {
SUBMIT: 'submitted',
View machine.js
// Vocal 'publishStatus' state machine
const machineId = 'publishing';
const publishMachine = Machine(
{
id: machineId,
initial: 'draft',
states: {
uninitialized: {
on: {
draft: 'draft',
@jesstelford
jesstelford / README.md
Last active Oct 23, 2019
Read SHAPE UP by basecamp in a single page or on a Kindle
View README.md

Read Shape Up by basecamp in a single page

Basecamp's new book Shape Up is now available online (https://basecamp.com/shapeup) to read page-by-page.

To read it all in a single page:

  1. Go to the first chapter: https://basecamp.com/shapeup/0.1-foreword
  2. In the URL bar, type javascript:
  3. Paste in this single line of JavaScript (so the URL bar looks like javascript:var style=do...)
View LEARNING_WEBDEV.md

Getting started

  • Everything except images in a website is text, so it's a lot of reading and writing. As such, it makes sense to use an editor built for the purpose to make your life easier.
  • Install Visual Studio Code (VSCode): https://code.visualstudio.com/
  • There are 3 main technologies that make up a website: HTML, CSS, JavaScript (JS)
@jesstelford
jesstelford / LEARNING_JS.md
Last active Aug 2, 2019
Learning JS links and suggestions
View LEARNING_JS.md

Learn by doing

If you're brand new to the language (welcome!) start here: http://jsforcats.com/ (Silly name, but excellent content)

If you've already got a little bit of coding under your belt, the ⁠⁠absolute best⁠⁠ place / way to learn is with https://nodeschool.io workshops (Full disclosure; I've written 2 of them)

They're all free open source at your own pace workshops where you are given a bit of info, a task, and you must code it up before you can move on (it runs unit tests over your code to verify you completed it)

@jesstelford
jesstelford / Links in markdown.md
Last active Oct 9, 2019
Putting links in code blocks on GitHub
View Links in markdown.md
@jesstelford
jesstelford / README.md
Last active Aug 29, 2016
Bug in autoprefixer v6.4.0 when used with postcss-discard-comments v2.0.4
View README.md
  1. $ git clone https://gist.github.com/3cdebdee4691ce5fdd4ae696db7f296f.git
  2. cd 3cdebdee4691ce5fdd4ae696db7f296f
  3. $ npm install
  4. $ npm start
  5. See the bug:
  TypeError: Cannot read property 'constructor' of null
    at clone (/home/teddy/dev/postcss-autoprefixer-bug/node_modules/autoprefixer/lib/prefixer.js:13:21)
    at clone (/home/teddy/dev/postcss-autoprefixer-bug/node_modules/autoprefixer/lib/prefixer.js:31:19)
    at clone (/home/teddy/dev/postcss-autoprefixer-bug/node_modules/autoprefixer/lib/prefixer.js:31:19)
@jesstelford
jesstelford / README.md
Last active Jun 15, 2019
Starving the Event Loop with Microtasks
View README.md

Starving the Event Loop with microtasks

"What's the Event Loop?"

Sparked from this twitter conversation when talking about doing fast async rendering of declarative UIs in Preact

These examples show how it's possible to starve the main event loop with microtasks (because the microtask queue is emptied at the end of every item in the event loop queue). Note that these are contrived examples, but can be reflective of situations where Promises are incorrectly expected to yield to the event loop "because they're async".

  • setTimeout-only.js is there to form a baseline
@jesstelford
jesstelford / event-loop.md
Last active Nov 15, 2019
What is the JS Event Loop and Call Stack?
View event-loop.md

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

You can’t perform that action at this time.