Skip to content

Instantly share code, notes, and snippets.

@plugnburn
plugnburn / README.md
Last active January 14, 2021 09:38
Zen.js - reactive nano-framework in 50 lines of JS

Zen.js

It seems that perfection is attained not when there is nothing more to add, but when there is nothing more to take away.

Antoine de Saint Exupéry

Zen.js is tiny attempt to create the Zen of reactive in-memory storage on the JS client-side environment.

How to obtain

@plugnburn
plugnburn / theme_descriptor.xml
Created February 13, 2020 21:22
Example NTH theme descriptor file for Nokia 8800 Classic and Special Edition - public tutorial
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE theme PUBLIC "-//NOKIA//DTD THEME 1.1//EN" "theme.dtd">
<!--
This is an example theme_descriptor.xml for Nokia 8800 Classic/Special (not Sirocco or Arte)
that can be used freely as a complete reference template to create other themes
Compilation: cd theme_dir && zip -9 ../MyExampleTheme.nth ./*
Note: all resource files MUST be present in the archive's root, no subdirectories!
-->
<theme name="MyExampleTheme" version="1.1">
<!-- (all icons and wallpapers hereafter can be of JPEG, PNG, BMP or GIF format, including animations) -->
@plugnburn
plugnburn / README.md
Last active November 16, 2019 10:42
ZenQRXT - all nano-goodness, combined

ZenQRXT - all nano-goodness, combined

This page aims to provide a downloadable bundle of four awesome nano-libraries that offer a complete client-side barebones stack: Zen.js, Q.js, R.js and XT.js. Please read about each library at its README page.

Using the bundle

Bundle size is 2641 bytes (1303 bytes gzipped). Download it right here or include it into your code:

@plugnburn
plugnburn / Novocarina.scad
Last active October 13, 2019 23:02
Novocarina: 3D-printable customizable English pendant style ocarina
This file has been truncated, but you can view the full file.
/**
* Novocarina: a fully 3D-printable ocarina with a side pendant loop and customizable inside bottom branding
* Optimized PLA settings: 20% infill, 0.3mm layer height, 10mm brim
*
* Key: C
*
* It has some differences from a standard 4-hole English pendant system ocarina:
* due to the nature of 3D printing in PLA, some tones actually have different keying
* (don't believe your musical tuners since they can't pick up any overtones,
* and these overtones play a very important role in shaping final pitch here).
@plugnburn
plugnburn / stl2scad.js
Last active October 11, 2019 19:10
STL2SCAD.js - Optimizing decompiler of a binary STL into the OpenSCAD source
/**
* Optimizing decompiler of a binary STL into the OpenSCAD polyhedron module
* @license Unlicense
*
* @param {ArrayBuffer} stl STL file contents (binary flavor)
* @param {string} optional custom name for OpenSCAD object (if none passed then 'object{NumTriangles}' will be used)
* @returns {string} ready OpenSCAD script
*/
function STL2SCAD(stl, optModName = null) {
var totalTriangles = new Uint32Array(stl.slice(80, 84))[0], //triangle amount is LE uint at byte 80
@plugnburn
plugnburn / frakturize.js
Created August 22, 2019 10:49
Frakturize: a small ES6 one-liner to generate Fraktur Unicode strings from a normal Latin
frakturize=s=>s.split('').map((c,i,h)=>/[a-zA-Z]/.test(c)?String.fromCodePoint((i=c.charCodeAt(0))>90?119997+i:((h='CHIRZ'.indexOf(c))>-1?8460+[33,0,5,16,28][h]:120003+i)):c).join('')
// Example: frakturize('ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz') => '𝔄𝔅ℭ𝔇𝔈𝔉𝔊ℌℑ𝔍𝔎𝔏𝔐𝔑𝔒𝔓𝔔ℜ𝔖𝔗𝔘𝔙𝔚𝔛𝔜ℨ 𝔞𝔟𝔠𝔡𝔢𝔣𝔤𝔥𝔦𝔧𝔨𝔩𝔪𝔫𝔬𝔭𝔮𝔯𝔰𝔱𝔲𝔳𝔴𝔵𝔶𝔷'
@plugnburn
plugnburn / paschenometer.js
Last active June 21, 2018 05:56
Paschenometer - visual image to text ratio meter for helpix.ru reviews
//copy the following into browser console and run
(()=>{
let root=document.querySelector('div[itemprop="reviewBody"]'),
selCalc = sel => [].slice.call(root.querySelectorAll(sel)).reduce((v,el)=> v + (parseFloat(getComputedStyle(el).height) || 0), 0),
totalImageHeight = selCalc('div[align="center"] img'), totalTextHeight = selCalc('p'),
totalHeight = totalImageHeight + totalTextHeight;
console.log('Percentage: images - ' + (100*totalImageHeight/totalHeight).toFixed(2) + '%, text - ' + (100*totalTextHeight/totalHeight).toFixed(2) + '%')
console.log('Paschenism ratio:', (totalImageHeight/totalTextHeight).toFixed(2))
})()
@plugnburn
plugnburn / README.md
Last active June 1, 2018 21:42
XT.js - DOM construction / templating library in 18 lines of JS, 323 bytes minified

XT.js

Let's close the ultra-small library cycle with some awesome array-based templating. 323 bytes minified.

How to obtain

Just download the minified version here or include it into your code:

@plugnburn
plugnburn / indexer.sh
Last active April 22, 2018 16:11
Catalite: Sqlite3-based text indexing and local search engine proof-of-concept in Bash
#!/bin/bash
# Catalite Indexer
# Adds new files or directories into the catalog database
# Usage: indexer.sh [db] [file|directory]
DB=''
openDb() {
DB="$*"
}
@plugnburn
plugnburn / LICENSE.txt
Last active March 14, 2018 01:13 — forked from 140bytes/LICENSE.txt
Whitespace text decoder
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 plugnburn
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE