Skip to content

Instantly share code, notes, and snippets.

View isaacs's full-sized avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
From 9a03c3e2d958202a0d1b9477a25406b5bd904a30 Mon Sep 17 00:00:00 2001
From: isaacs <i@izs.me>
Date: Mon, 8 Jul 2024 10:44:26 -0700
Subject: [PATCH] Add note about using EOL release versions
As much as we can recommend against this, people are still going to do it
sometimes. We may as well help users reduce the risk and also give package
authors something to point to when the predictable breakage occurs.
---
apps/site/pages/en/about/previous-releases.mdx | 9 +++++++++
let g:coc_global_extensions = ['coc-tsserver', 'coc-json']
" Add CoC Prettier if prettier is installed
" if isdirectory('./node_modules') && isdirectory('./node_modules/prettier')
" let g:coc_global_extensions += ['coc-prettier']
" endif
nmap <leader>gn <Plug>(coc-diagnostic-prev)
nmap <leader>gm <Plug>(coc-diagnostic-next)
nmap <leader>gd <Plug>(coc-definition)
nmap <leader>gy <Plug>(coc-type-definition)
nmap <leader>gi <Plug>(coc-implementation)
console.error('register extension', process.version)
const { writeFileSync, readFileSync } = require('fs')
const transpile = exports.transpile = file => {
const src = readFileSync(file, 'utf8')
const tx = `console.log(${JSON.stringify(src)})`
writeFileSync(file + '.cjs', tx)
}
require.extensions['.foo'] = (module, file) => {
transpile(file)
module.filename = file + '.cjs'
import { Test } from '@tapjs/test'
import assert from 'node:assert'
const t = new Test({})
t.stream.pipe(process.stdout)
t.before(() => {
assert.equal(t.t, t, 'self ref is equal in before()')
})
// The idea here is that a plugin is a module that exports a function which
// takes a test object as an argument, and returns any kind of object.
// utility types
type SecondParam<
T extends [any] | [any, any],
R extends unknown = unknown
> = T extends [any, any] ? T[1] : R
const copyToString = (v: Function) => ({
> bench-lru@1.2.1 start
> NODE_ENV=production node index.js
int: just an integer
failed prototype pollution check
| name | set | get1 | update | get2 | evict | score |
|------------------------------------------------------------------|-------|-------|--------|-------|-------|--------|
| [just an obj](Object.create(null)) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 |
| [just a {}]({}) | 25000 | 33333 | 25000 | 33333 | 25000 | 466664 |
// look at this glorious shit!! look what you can do with with!!
const someObject = {
foo: 'bar',
baz: 1,
asdf: ['quux'],
}
with (someObject) {
console.log(foo)
@isaacs
isaacs / benchmarks.txt
Created February 21, 2023 07:12
Current in-development benchmarks of node-glob v9, 2023-02-20
--- pattern: './**/0/**/0/**/0/**/0/**/*.txt' ---
~~ sync ~~
node fast-glob sync 0m0.523s 10
node globby sync 0m0.514s 10
node current glob.sync mjs 0m0.570s 10
node current glob syncStream 0m0.584s 10
~~ async ~~
node fast-glob async 0m0.280s 10
node globby async 0m0.292s 10
node current glob async mjs 0m0.324s 10
@isaacs
isaacs / s.js
Last active February 6, 2023 22:55
const apiKey = {{ stripe test private key goes here }}
const html = `
<!doctype html>
<html>
<head>
<script type="module">
import { Tier } from 'https://unpkg.com/tier@5.0.3/dist/mjs/client.js'
const tier = new Tier({
apiKey: ${JSON.stringify(apiKey)},
baseURL: 'https://api.tier.run',