Skip to content

Instantly share code, notes, and snippets.

@lostfictions
lostfictions / minitrace.js
Last active November 27, 2021 20:08
tiny tiny tracery-like
const matcher = /\[([^\[\]]+)\]/g
function randomInArray(arr) { return arr[Math.floor(Math.random() * arr.length)] }
export default function generate(concepts, concept, maxCycles = 10, seen = {}) {
if(!concepts[concept]) {
return `{error: unknown concept "${concept}"}`
}
return randomInArray(concepts[concept])
.replace(matcher, (_, nextConcept) => {
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>avre</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
.squiggle {
@lostfictions
lostfictions / FixUnityDocs.user.js
Last active April 29, 2024 02:30
Greasemonkey and Tampermonkey script to rewrite Unity3d.com API documentation URIs (so that you can open links in a new tab/window.) Works on both docs.unity3d.com and locally-installed copies (though you may have to change the @match directive to work on OSX.)Also fixes page titles, which have been broken ever since the documentation format was…
// ==UserScript==
// @name Unity Documentation Helper
// @namespace http://twitter.com/doam
// @version 0.15
// @description Tweak Unity docs to show API names and search queries in the title.
// @match http://docs.unity3d.com/ScriptReference/*.html*
// @match file:///*/Unity/Editor/Data/Documentation/*/ScriptReference/*.html*
// @copyright 2013-2015 six
// ==/UserScript==