Skip to content

Instantly share code, notes, and snippets.

@40thieves
40thieves / ldn8-final-project-presentations.md
Last active August 5, 2022 11:35
Tips for CYF LDN8 final project presentations

LDN8 final project presentations

Tips

Introduction

  • Don't spend time talking about the volunteers that helped with your project - the demo day is about you! Employers don't care about volunteers! (It's fine, the volunteers already know that you appreciate it!)
  • It's a good idea to say what type of job that you're interested in - so if you'd like to be a backend dev, say so!

Presentation

@40thieves
40thieves / machine.js
Created August 4, 2021 09:49
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'http',
initial: 'idle',
context: {
data: []
},
states: {
idle: {
on: {
FETCH: 'loading'
@40thieves
40thieves / machine.js
Last active August 4, 2021 13:10
Generated by XState Viz: https://xstate.js.org/viz
const sleepMachine = Machine({
initial: 'awake',
states: {
awake: {
on: {
GO_TO_SLEEP: 'asleep'
}
},
asleep: {
on: {

Fixing ESLint problems with the pokedex app on a Windows computer

Step 1: Remove the eslint disable comments

  1. In your pokedex project, find all the files with a comment like: /* eslint-disable indent, linebreak-style */
  2. Edit the comment to remove the linebreak-style bit, so that it just becomes /* eslint-disable indent */

This will cause ESLint to fail, but don't worry we'll fix it in the next step :)

Step 2: Change the End of Line Sequence in your files

Fixing ESLint in your pokedex app

In your lesson you may have encountered some ESLint errors, don't stress about it, this is not your fault! An issue slipped into the CYF template code and now we will fix it together 🙂

ESLint rules are designed to help you by making sure your code is consistent. It is common to for companies to turn on ESLint rules so that every developer that the company writes code in a similar way. During the lesson we did not have enough time to fix everyone's code to match the rules.

To fix the problem, there are 2 possible solutions:

  • A quick fix, which simply disables the rules. This will get you writing React code faster, but in the future you may have problems with code that is inconsistent with other trainee's
  • A more complete fix, but will change your editor config so that your code will be consistent in VSCode from now on
@40thieves
40thieves / machine.js
Last active January 6, 2021 09:35
Generated by XState Viz: https://xstate.js.org/viz
const chatMachine = Machine({
id: "chat",
type: "parallel",
context: {
messages: []
},
states: {
http: {
initial: "idle",
states: {
@40thieves
40thieves / machine.js
Created January 5, 2021 17:59
Generated by XState Viz: https://xstate.js.org/viz
const chatMachine = Machine({
id: "chat",
initial: "idle",
context: {
messages: []
},
states: {
idle: {
on: {
fetch: "fetching",
@40thieves
40thieves / machine.js
Last active January 5, 2021 17:54
Generated by XState Viz: https://xstate.js.org/viz
const chatMachine = Machine({
id: "chat",
initial: "idle",
context: {
messages: []
},
states: {
idle: {
on: {
fetch: "fetching",
@40thieves
40thieves / index.html
Last active August 25, 2020 08:55
Demo of async script loading
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Script loading</title>
</head>
<body>
Hello world
@40thieves
40thieves / prevent-jsx-array-length-and-operator-without-comparison-eslint-rule.js
Created July 8, 2020 13:47
Custom ESLint rule to catch a footgun in JSX when using && operator with array length comparison
/*
* Catches this footgun:
*
* {myArray.length && (
* <div>Foo</div>
* )}
*
* which renders "0" if myArray is empty
*
* It should instead be: