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
// Generated by Claude | |
// Some details hand tuned | |
import fs from 'fs' | |
import ts from 'typescript'; | |
import path from 'path'; | |
function getConfig() { | |
const args = process.argv.slice(2); | |
const jsonIndex = args.indexOf('--json'); | |
const useJson = jsonIndex !== -1; |
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
package html_builder | |
import "core:fmt" | |
import "core:strings" | |
Attr :: struct { | |
name: string, | |
value: string, | |
} |
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 type * as csstype from "csstype"; | |
class Sheet { | |
domSheet: CSSStyleSheet | null; | |
rulesCount = 0; | |
constructor() { | |
let el = document.createElement("style"); | |
el = document.head.appendChild(el); | |
if (!el.sheet) { | |
console.error("failed to created style element"); |
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
[ | |
{ | |
"kanji": "亜", | |
"oldForm": "亞", | |
"readings": [ | |
"ア" | |
], | |
"examples": [ | |
[ | |
"亜流", |
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
This code is shared as-is. Use at your own risk. | |
It is not meant to be depended upon as a module. Instead, copy it to your own code base and make changes as needed. | |
CC0/MIT-0/Unlicense | |
It generates type definitions for structs and enums in Go to Typescript. | |
It's only meant to be executed locally; during development. |
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
package esbuilder | |
import "os" | |
import "path" | |
import "fmt" | |
import "log" | |
import "time" | |
// the main hero! | |
import "github.com/evanw/esbuild/pkg/api" |
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 * as refs from "./refs"; | |
class ById { | |
constructor(public param: any) { } | |
} | |
// wraps an object in a special flag so that the cache uses the object's id instead of hashing its keys and values | |
export function byId(param: any) { | |
return new ById(param) | |
} |
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
// How to build: | |
// # compile the metal shaders | |
// xcrun -sdk macosx metal -c shaders.metal -o shaders.air | |
// xcrun -sdk macosx metallib shaders.air -o shaders.metallib | |
// # compile the c file | |
// clang app_metal.c -framework Cocoa -framework Metal -o metal_c.app | |
// | |
// | |
// Draw a triangle using metal | |
// Metal tutorial followed here: https://www.raywenderlich.com/7475-metal-tutorial-getting-started |
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 fileinput | |
import re | |
import sys | |
``` | |
eg. [東京]{とうきょう} -> <ruby>東京<rp>(</rp><rt>とうきょう</rt><rp>)</rp></ruby> | |
``` | |
def furiganize(line): | |
# (?<!\\) means don't match if preceeded by a backslash | |
return re.sub(ur'(?<!\\)\[(.*?)\]\{(.*?)\}', ur'<ruby>\1<rp>(</rp><rt>\2</rt><rp>)</rp></ruby>', line.rstrip()) | |
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
echo = function(areq) { console.log(areq.response) }; | |
requests = (function() { | |
var module = {}; | |
var AsyncRequest = XMLHttpRequest; | |
// takes a dict and returns a string "a=b&c=d" | |
var toUrlParams = function(dict) { | |
var res = []; | |
for(var key in dict) { |
NewerOlder