Many of the more "advanced" typescript features can be used for creating "value-derived" types.
At its simplest form:
let vehicle = { name: "Van", wheels: 4 }| // from/to: { left, top, width, height, shape: 'circle' | 'rect' } | |
| function CurvedArrow({ from, to }) { | |
| function curvedHorizontal(x1, y1, x2, y2) { | |
| function pos(t) { | |
| let mx = x1 + (x2 - x1) / 2; | |
| let p1 = {x: x1, y: y1}; | |
| let p2 = {x: mx, y: y1}; | |
| let p3 = {x: mx, y: y2}; | |
| let p4 = {x: x2, y: y2}; | |
| return { |
This gist lists challenges you run into when building offline-first applications based on IndexedDB, including open-source libraries like Firebase, pouchdb and AWS amplify (more).
Note that some of the following issues affect only Safari. Out of the major browsers, Chrome's IndexedDB implementation is the best.
When this bug occurs, every time you use the indexeddb, the WAL file grows. Garbage collection doesn't seem to be working, so after a while, you end up with gigabytes of data.
| export default (function create(options = {}) { | |
| const client = { | |
| headers: options.headers || {}, | |
| create | |
| }; | |
| const events = {}; | |
| client.emit = (type, e) => { | |
| events[type] && | |
| events[type].slice().map(fn => { |
| import { h, Component } from 'preact'; | |
| import { Router } from 'preact-router'; | |
| import Header from './header'; | |
| import Home from '../routes/home'; | |
| import Profile from '../routes/profile'; | |
| import NotifyChange from "./NotifyChange/index"; | |
| // import Home from 'async!../routes/home'; | |
| // import Profile from 'async!../routes/profile'; |
Problem: How can we preprocess JavaScript (at build-time or on the server-side) so engines like V8 don't have to spend as much time in Parse? This is a topic that involves generating either bytecode or a bytecode-like-abstraction that an engine would need to accept. For folks that don't know, modern web apps typically spend a lot longer in Parsing & Compiling JS than you may think.
in OS X 10.4 to macOS sierra 10.12 and maybe higher!
Copy this entire code block and paste it into your terminal and push Return to create this file for you with correct permissions. It will (probably) ask for your password:
Kyle Simpson (@getify) wrote a very thoughtful post decrying optimize-js, which is a tool I wrote that exploits known optimizations in JavaScript engines to make JS bundles parse faster (especially minified bundles, due to what could be reasonably described as a bug in Uglify).
Kyle lays out a good case, but I tend to disagree with nearly all his points. So here's my rebuttal.
| // See https://blog.isquaredsoftware.com/presentations/react-redux-ts-intro-2020-12/#/36 for slides | |
| // My basic render function structure: | |
| function RenderLogicExample({ | |
| someBoolean, // 1) Destructure values from `props` object | |
| someList, | |
| }) { | |
| // 2) Declare state values | |
| const [a, setA] = useState(0); | |
| const [b, setB] = useState(0); |
My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...
Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they