This is a demonstration of using Preact without any build tooling. The library is linked from the esm.sh CDN, however a standalone JS file exporting HTM + Preact + Hooks can also be downloaded here.
import pygame | |
import time | |
import random | |
class Snake: | |
def __init__(self): | |
self.body = [(0, 0)] | |
self.direction = 'right' | |
def draw(self, screen): |
/* | |
This is not meant to be a final CSSWG proposal, | |
but reflects my immediate thoughts after reading | |
[David Baron's](https://github.com/dbaron/container-queries-implementability) promising draft. | |
This gist was created to demonstrate my idea for removing selectors from his query syntax. | |
More of my thoughts & notes are online at css.oddbird.net/rwd/ | |
*/ | |
main, |
- Documentation: https://web.dev/articles/eventsource-basics
- Use case: broadcasting data from server to browsers
- Benefits:
- Easy to understand and implement (only a few lines of code)
- No library is needed
- Can use same HTTP(S) authentication as elsewhere in the app (which can’t be done with websockets)
const bypass = [ | |
// function names to avoid logging | |
]; | |
const collapsed = [ | |
// function names to groupCollapsed | |
]; | |
module.exports = function(babel) { | |
const { types: t } = babel; | |
const wrapFunctionBody = babel.template(`{ |
# This is for ElasticBeanstalk with Amazon Linux 2023. For previous Linux 2 or Linux 1, see revisions for ideas | |
packages: | |
yum: | |
cups-libs: [] | |
libdrm: [] | |
libXdamage: [] | |
libXfixes: [] | |
libXrandr: [] | |
mesa-libgbm: [] | |
libxkbcommon: [] |
All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.
A number of methods in React are assumed to be "pure".
On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.
let cache = new Map(); | |
let pending = new Map(); | |
function fetchTextSync(url) { | |
if (cache.has(url)) { | |
return cache.get(url); | |
} | |
if (pending.has(url)) { | |
throw pending.get(url); | |
} |
'use strict' | |
const toUpper = async string => { | |
if (string === 'invalid') return [Error('Invalid input')] | |
return [null, string.toUpperCase()] | |
} | |
const errorHandler = () => { console.log('There has been an error. I\'ll handle it.') } | |
const print = console.log | |
const foo = async input => { |
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would