Skip to content

Instantly share code, notes, and snippets.

View voxpelli's full-sized avatar
🏡
Away from coding to take care of mental health

Pelle Wessman voxpelli

🏡
Away from coding to take care of mental health
View GitHub Profile
@voxpelli
voxpelli / main.js
Last active April 19, 2022 12:43
A recursive Promise.all() that works on objects
const zipObject = function (keys, values) {
const result = {};
keys.forEach((key, i) => {
result[key] = values[i];
});
return result;
};
@AdaRoseCannon
AdaRoseCannon / HTMLElementPlus.js
Last active March 3, 2023 11:33
HTML Element Plus for Web Components
'use strict';
class HTMLElementPlus extends HTMLElement {
static defaultAttributeValue() {
/* the name of the attribute is parsed in as a parameter */
return;
}
static parseAttributeValue(name, value) {
@leebyron
leebyron / PriorityQueue.js
Last active January 28, 2019 05:08
PriorityQueue.js uses a binary heap to ensure the highest priority item is always available to dequeue, and sorts on enqueue. A dynamically resizing Array can be used to model the binary heap, for a simpler and more efficient implementation.
/**
* For compare function return:
* - Less than zero: item1 has higher priority than item2.
* - Zero: same.
* - Greater than zero: item1 has lower priority than item2.
*/
export type CompareFunction<T> = (item1: T, item2: T) => number;
export class PriorityQueue<T> {
_items: Array<T>;
{
"title": "Asset Metadata",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Identifies the asset to which this NFT represents",
},
"description": {
"type": "string",
@Andarist
Andarist / cherry-pick_tree_example.md
Last active June 7, 2018 08:39
cherry-pick tree example
Input:                 Output:

.                      .
├── es                 ├── effects
│   ├── effects.js     │   └── package.json
│   ├── index.js       ├── es
│   └── utils.js       │   ├── effects.js
├── lib                │   ├── index.js
│   ├── effects.js │   └── utils.js

Fixing macOS 10.14, 10.15, 12

Dark main menu without the rest of dark mode

  1. Set Light mode
  2. defaults write -g NSRequiresAquaSystemAppearance -bool Yes
  3. Log out and log back in
  4. Set Dark mode
@marcedwards
marcedwards / perlintextdisplacement.pde
Created April 9, 2019 12:18
Perlin noise text displacement
//
// Perlin noise text displacement.
// Created using Processing 3.5.3.
//
// Code by @marcedwards from @bjango.
//
PGraphics textbuffer;
void setup() {
// Used in real world eg. here: https://github.com/voxpelli/node-format-microformat/blob/5381268dbcdb1aef6a5757758710e4b9f75cbea3/index.js#L72-L78
// Works
/** @typedef {null|undefined|boolean|string|number|Array} NonObject */
/**
* @template T
* @typedef {T|Promise<T>} MaybePromised
@voxpelli
voxpelli / template-tag-factory.js
Created January 22, 2020 14:58
A small little helper for creating a template tag where one can modify the static strings, the values and/or the final output in some way. Eg. trim some whitespaces?
/**
* @template T
* @param {T} value
* @returns {T}
*/
const passthrough = value => value;
/**
* @param {object} [options]
* @param {(value: string) => string} [options.staticCallback]
@brunobord
brunobord / _readme.md
Last active December 27, 2020 01:16
Various Digirule programs

Various Digirule 2U programs

  • d6.asm a six-sided dice roller
  • k2000.asm K2000-like flash-light.
  • k2000-loop.asm same as above, with 2 loops (This version is stored in fewer RAM slots, but it's slower because of an extra instruction).
  • fibonacci.asm a basic Fibonacci series computation, displayed on the Data LEDs. The maximum result will be 233, and then it "crashes", all Data LEDs will blink as if it was an error signal.
  • christmas.asm a XMas light using RANDA for the data LEDs + Speed for blinking delay.
  • christmas-advanced.asm Expanded version, still using a random SPEED + blinking both DATA & ADR LEDs.

How can I use this?