class ReSocket { | |
private token: string | undefined; | |
private socket: WebSocket | undefined; | |
private listeners: boolean = false; | |
private currentAttempt: number = 0; | |
private backoffTime: number = 1000; | |
private maxAttempts: number = 30; | |
private timer: NodeJS.Timeout | undefined; | |
private messageFn: (data: any) => void = (data) => { | |
// |
// SPDX-License-Identifier: MIT-0 | |
export interface Env { | |
} | |
export default { | |
async fetch( | |
request: Request, | |
env: Env, |
class RepositoryNamespace<Entity = string, Metadata = {}> { | |
private readonly ns: string | |
private readonly kv: KVNamespace | |
constructor(kv: KVNamespace, namespace: string) { | |
this.ns = namespace | |
this.kv = kv | |
} | |
put(key: string, entity: Entity) { |
// Code moved here: https://2ality.com/2021/06/error-cause.html#a-custom-error-class |
/**! | |
* Fast CRC32 in JavaScript | |
* 101arrowz (https://github.com/101arrowz) | |
* License: MIT | |
*/ | |
// If you use this code, please link this gist or attribute it somehow. | |
// This code uses the Slice-by-16 algorithm to achieve performance | |
// roughly 2x greater than all other JS CRC32 implementations (e.g. |
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'
instead ofconst foo = require('foo')
to import the package. You also need to put"type": "module"
in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)
from CommonJS instead ofrequire(…)
. - Stay on the existing version of the package until you can move to ESM.
(I'm enjoying doing these raw, barely edited writeups; I hope they're useful to you too)
This is my own writeup on feature flags; for a deep dive I'd recommend something like Martin Fowler's article (https://martinfowler.com/articles/feature-toggles.html).
So. Feature flags. The basic idea that you'll store configuration/values on a database/service somewhere, and by changing those values, you can change the user experience/features for a user on the fly.
Let's say that you're building a new feature, called 'new-button' which changes the color of buttons, which is currently red, to blue. Then you'd change code that looks like this -
tips to evolve as a developer
developers get stuck, paralized
https://www.oreilly.com/library/view/apprenticeship-patterns/9780596806842/ch04.html
Make It Stick https://www.amazon.com.br/Make-Stick-Science-Successful-Learning/dp/0674729013
📝 I submit the same text to GitHub Support.
I want to use same scope for npm package and GitHub Package Registry.
For example, @org
scope exist in npm and GitHub.
@org/foo-public
package is public on npm registry@org/bar-private
package is private on GitHub Package Registry