Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@btakita
btakita / issemantic.js
Last active March 21, 2024 04:14
https://issemantic.net/ visualization helper scripts
/**
* Use these utility functions in the developer console.
* url__update & snippet__update will load the document & start the visualizer.
* These functions will make the visualizer UI taller & scroll to the top of the visualizer.
*
* ```js
* url__update('https://example.com')
?* snippet__update('Your HTML')
* ```
*/
@btakita
btakita / Raw.ts
Last active November 1, 2023 09:43
van export-shared-types branch example
/// <reference lib="dom" />
import { type Van as MiniVan } from 'mini-van-plate'
import type { VanShape } from 'mini-van-plate/shared'
import { type Element as VanPlateElement, type ElementProto } from 'mini-van-plate/van-plate'
export function Raw<V extends VanShape>(van:V, html:string):Return<V>{
if (globalThis['window']) return htmlDocumentFragment(html) as Return<V>
const { __proto__ } = van.tags.div() as any as { __proto__:ElementProto }
return {
__proto__,
render: __proto__.render,
@btakita
btakita / gist:950e242985b65dda6606b370e31f7033
Last active May 24, 2023 02:00
Upstash Pay as you go vs EC2 Redis
9179 records (1 SET, 9179 HSET): company_gender
Upstash: 11590.06ms 172MB
EC2: 9001.75ms 141MB
8775 records: company_person
Upstash: 39417.53ms 1037MB
EC2: 38153.58ms 1040MB
11400 records (1 SET, 0-22800 HSET): iex__company
Upstash: 26545.97ms 1037MB
@btakita
btakita / openai__TransformStream__JSONStreamParser.js
Last active April 26, 2023 00:21
Streaming JSON parser generated by openai
class JSONStreamParser {
constructor() {
this.buffer = '';
this.state = this.parseValue;
}
transform(chunk, controller) {
this.buffer += chunk;
for (let i = 0; i < this.buffer.length; i++) {
const char = this.buffer.charAt(i);
@btakita
btakita / mckenzie_starlite__replacement__bumper.svg.ts
Last active October 26, 2022 06:06
mckenzie_starlite__replacement__bumper.svg.ts
import { writeFile } from 'fs/promises'
import { dirname, join } from 'path'
import PDFDocument from 'pdfkit'
import SVGToPdf from 'svg-to-pdfkit'
// 96.75
// 8 x 7.5
const in__px = 96
const page__width__in = 11
const page__height__in = 8.5
const page__margin_x__in = .5
@btakita
btakita / out-of-order-data-hk.html
Created January 14, 2022 18:11
Compare the .Layout_company element with .Layout_nav_footer_header
<main data-hk="0.0.0.0.0.0.0.0.1.0" class="_layout "><div
data-hk="0.0.0.0.0.0.0.0.1.1.0.0.0.0.2.0.5" class="Company_Page companies_index_route"><!--#--><!--/--><!--#--><div
data-hk="0.0.0.0.0.0.0.0.1.1.0.0.0.0.2.0.7.0" class="Layout_companies " class=" "><a class="ctx-ribbon"
href="https://docs.google.com/forms/d/e/1FAIpQLScdm8Sf4yBGNpUCES2j6T-DDuqO2A5JDyiWj1PzS5aPd5VEfQ/viewform"
title="&amp;#946&amp;#949&amp;#932&amp;#913 &amp;#8594 Please send your feedback!"
target="_blank">BETA: Please send your feedback!</a>
<!--#--><div data-hk="0.0.0.0.0.0.0.0.1.1.0.0.0.0.2.0.7.1.0" class="Layout_app"><div
data-hk="0.0.0.0.0.0.0.0.1.1.0.0.0.0.2.0.7.1.2.0" class="Layout_company"><div
data-hk="0.0.0.0.0.0.0.0.1.1.0.0.0.0.2.0.7.1.2.1.0" class="companies_index_route_content"><!--#--><!--/--><div></div>
<!--#--><div data-hk="0.0.0.0.0.0.0.0.1.1.0.0.0.0.2.0.7.1.2.1.1.0" class="blank"
<Placemark>
<name>Property</name>
<LineString>
<tessellate>1</tessellate>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>
29.7479,-103.7888
29.7444,-103.7888
29.7480,-103.7846
29.74444,-103.7846

% Dhall: A programmable configuration language % Gabriel Gonzalez % December 15, 2020


Overview

<style lang="scss"> :not(.overview) > .slides {