Skip to content

Instantly share code, notes, and snippets.

View nberlette's full-sized avatar
🧱
make, break, patch, repeat ad infinitum

Nicholas Berlette nberlette

🧱
make, break, patch, repeat ad infinitum
View GitHub Profile
@nberlette
nberlette / LICENSE
Last active April 17, 2025 07:06
Virtual File System API (mostly compatible with `node:fs`)
The MIT License (MIT)
Copyright (c) 2025+ Nicholas Berlette (https://github.com/nberlette)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@nberlette
nberlette / ansi_reference.md
Last active April 25, 2025 22:48
ANSI Escape Sequences Reference (VT100 et al)
@nberlette
nberlette / LICENSE
Last active March 18, 2025 21:16
Advanced Unicode Table Rendering
The MIT License (MIT)
Copyright (c) 2024-2025 Nicholas Berlette. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@nberlette
nberlette / workers_ai_playground_prompts.md
Created March 4, 2025 10:59
Workers AI Playground Prompts

Deno Code Generator

System Prompt

You are a friendly expert software engineer. If the user requests you generate code, assume 
they want it written in TypeScript for Deno, and follow these rules to the letter: The code
should avoid using any external dependencies, unless absolutely necessary or specifically
@nberlette
nberlette / index.html
Last active December 6, 2024 00:15
Window Mangement Web Component Library
<div class="editor">
<n-window id="window1" class="window">
<n-view slot="views">
<n-tab slot="tabs" part="primary">Explorer</n-tab>
<n-tab slot="tabs" part="primary">Search</n-tab>
<n-tab slot="tabs" part="primary">Extensions</n-tab>
<div slot="content" name="panel-0">
<n-view>
<n-tab slot="tabs" active>File 1</n-tab>
@nberlette
nberlette / impl_wrapper_with_trait.rs
Last active November 13, 2024 00:35
[rust macro] impl_wrapper_with_trait
#[macro_export]
macro_rules! impl_wrapper_with_trait {
// Match multiple wrapper types with external type and default implementation (no custom tt)
(
$(
$(#[$meta:meta])*
$(unsafe)? $($vis:vis,? )? $wrapper:ident$(<$($lifetime:lifetime),+>)?$( : $ty:ty)? => $path:path $(,)? $({
$($body:block)+
})? $(,)?
$(,)?)+
@nberlette
nberlette / self-bind.ts
Last active July 17, 2024 08:47
recursive method binding tool (typescript)
/**
* Binds all functions and accessors of an object to a specified 'thisArg'.
*
* This has proven to be particularly useful in scenarios where you want to
* subclass the native `Function` API, and want to be able to call `this` from
* within the function body string that you pass to `super()`. This allows you
* to effortlessly create a callable object, which can be invoked directly as
* a function or also by calling the corresponding method that is aliased by
* the super's function body. See the example below for a real-world
* demonstration.
@nberlette
nberlette / temporal-proxy.ts
Last active May 25, 2024 16:36
TemporalProxy
// deno-lint-ignore-file ban-types
import { is } from "jsr:@type/[email protected]";
/**
* Simple abstraction using the native `Proxy` and `Proxy.revocable` APIs to
* create temporary, "restorable" proxies of a given target object. This is
* particularly well-suited for testing and mocking purposes, allowing one to
* create a virtually indistinguishable proxy of an object or function that is
* to be tested, apply custom spying / mocking logic, and still be capable of
@nberlette
nberlette / extract-workers-ai-models.ts
Last active February 27, 2024 10:35
WorkersAI: utility to extract LLM model data from Cloudflare Workers AI docs
/*!
* Run this script with Deno to extract all models from the Workers AI
* documentation site (https://developers.cloudflare.com/workers-ai/models).
*
* @example
* ```sh
* # install Deno if you do not have it already
* curl -fsSL https://deno.land/install.sh | sh -
*
* # run the script
@nberlette
nberlette / LICENSE
Last active November 26, 2024 09:03
Outdent: highly configurable, modern re-implementation of the popular outdent module
The MIT License (MIT)
Copyright © 2023-2024 Nicholas Berlette (https://github.com/nberlette)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: