- Encryption algorithm: aes-256-gcm
- Hashing algorithm: sha512
- Key derivation algorithm: pbkdf2
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bench = ( name, fn ) => { | |
console.time ( name ); | |
fn (); | |
console.timeEnd ( name ); | |
}; | |
const run = () => { | |
const dumb = 'a'.repeat ( 4000000 ).replace ( /[\r\0]/g, '' ); // The seemingly useless regex here makes things go faster later on |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Monaco Editor can be easily created, given an | |
// empty container and an options literal. | |
// Two members of the literal are "value" and "language". | |
// The editor takes the full size of its container. | |
const WarAndPeace = `# 00 - A War and Peace | |
BOOK ONE: 1805 | |
CHAPTER I |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type _ = { | |
partial: Partial | |
}; | |
type Partial = { | |
/* WITH PLACEHOLDERS */ | |
<T1, R> ( fn: FN<[T1], R>, a1: _ ): FN<[T1], R>, | |
<T1, T2, R> ( fn: FN<[T1, T2], R>, a1: _ ): FN<[T1, T2], R>, | |
<T1, T2, R> ( fn: FN<[T1, T2], R>, a1: _, a2: T2 ): FN<[T1], R>, | |
<T1, T2, R> ( fn: FN<[T1, T2], R>, a1: T1, a2: _ ): FN<[T2], R>, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bundle-bytes () { | |
#FIXME: code-only bundles, for some reaon the "--external" flags aren't respected | |
local full=`esbuild $@ --bundle --minify`; | |
local full_min=`echo $full | wc -c`; | |
local full_gzip=`echo $full | gzip | wc -c`; | |
local dependencies=`jq '.dependencies|keys[]' package.json`; | |
local dependencies_external=`echo $dependencies | sed -e 's/^/--external:/' | tr '\n' ' '`; | |
local code=`esbuild $@ --bundle --minify $dependencies_external`; | |
local code_min=`echo $code | wc -c`; | |
local code_gzip=`echo $code | gzip | wc -c`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* IMPORT */ | |
const esbuild = require ( 'esbuild' ); | |
const {nodeExternalsPlugin} = require ( 'esbuild-node-externals' ); | |
const monex = require ( 'monex' ); | |
const path = require ( 'path' ); | |
const {color, parseArgv} = require ( 'specialist' ); | |
const Watcher = require ( 'watcher' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require ( 'fs' ); | |
const content = fs.readFileSync ( 'War and Peace.md', 'utf-8' ); | |
const charCodesAt = new Array ( content.length ); | |
console.time('charCodeAt'); | |
for ( let i = 0, l = content.length; i < l; i++ ) { | |
charCodesAt[i] = content.charCodeAt ( i ); | |
} | |
console.timeEnd('charCodeAt'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can you make this faster? Ping me. | |
const escapeHtml = (function () { | |
const serializer = new XMLSerializer (); | |
const attr = document.createAttribute ( 'attr' ); | |
const re = /[&<>"]/; | |
return function escapeHtml ( str ) { | |
if ( !re.test ( str ) ) return str; | |
attr.value = str; | |
return serializer.serializeToString ( attr ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// It's the fastest pure-JS base64 encoder (that doesn't account for padding though) that I've found. | |
// It's cursed because it takes ~2s to startup and 16MB of memory 😂 | |
const encoder = new TextEncoder (); | |
const lookup = (() => { | |
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split ( '' ); | |
const lookup = new Array ( 2 ** 24 ); | |
const mask1 = 0b11111100_00000000_00000000; | |
const mask2 = 0b00000011_11110000_00000000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* IMPORT */ | |
import _ from 'lodash'; | |
import {Text} from '~/components'; | |
import {Utils} from '~/lib'; | |
import {useRef, useClass} from '~/hooks'; | |
import {observable, computed, Component} from '~/view'; | |
import {Class, Styles} from './styles'; | |
import {Props} from './types'; |
OlderNewer