Skip to content

Instantly share code, notes, and snippets.

View davay42's full-sized avatar
✌️
Open source development for amazing future ✨

davay davay42

✌️
Open source development for amazing future ✨
View GitHub Profile
/*
* ESP32 Counter with OLED Display and Encoder
*
* Hardware required:
* - ESP32 development board
* - SH1106 128x64 OLED Display (I2C)
* - Rotary Encoder with push button
* - 2 additional buttons
*
* Wiring:
@davay42
davay42 / Matter.RenderSVG.js
Created May 26, 2024 05:08 — forked from taylor8294/Matter.RenderSVG.js
The `RenderSVG` module is an SVG alternative to the Matter.js built-in canvas-based renderer.
/**
* Overwrite `Common.isElement` to allow for SVG elements also
*/
Matter.Common.isElement = function(obj) {
try {
return obj instanceof HTMLElement || obj instanceof SVGElement;
} catch (e) {
return (typeof obj === "object") &&
(obj.nodeType === 1) && (typeof obj.style === "object") &&
(typeof obj.ownerDocument === "object");
@davay42
davay42 / GenerateAudioWaveform
Created July 3, 2023 05:58 — forked from jessuni/GenerateAudioWaveform
Audio Oscilloscope (Frequency Byte) - w/ web audio API and canvas
// rename gist
@davay42
davay42 / sendBlobJson.js
Created April 24, 2023 10:55 — forked from Dletta/sendBlobJson.js
sending JSON objects via Blobs
var obj = {name:"test", result:"hello world"};
var string = JSON.stringify(obj);
console.log(obj)
var arr = [];
encode = Array.from(string);
while(encode.length>0){
arr.push(encode.shift().charCodeAt(0));
}
var u16 = new Uint16Array(arr);
var blob = new Blob([u16], {type:'application/json'});
@davay42
davay42 / index.html
Created April 24, 2023 10:54 — forked from Dletta/index.html
Gun in Service Worker
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Concept Chat</title>
<link rel="stylesheet" href="index.css" >
</head>
<body>
@davay42
davay42 / vitepress-tags.js
Last active April 9, 2021 08:18
Vitepress pages tags collections
import fs from 'fs'
import path from 'path'
import matter from 'gray-matter'
import { glob } from 'glob'
export function getTags(dir = '../../pages', pattern = '/**/*.md') {
const pageDir = path.resolve(__dirname, dir)
const filesList = glob.sync(pageDir + pattern, { nodir: true })
@davay42
davay42 / plink-plonk.js
Created February 23, 2020 21:18 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@davay42
davay42 / index.html
Created March 19, 2019 09:59
webgl metaballs
<script type="x-shader/x-vertex" id="vertexMetaballs">
attribute vec2 position;
void main() {
gl_Position = vec4(position, 0.0, 1.0);
}
</script>
<script type="x-shader/x-fragment" id="fragmentMetaballs">
precision highp float;
const int NUM_METABALLS = 15;
@davay42
davay42 / index.pug
Created September 30, 2018 18:25
vue-draggable-nested-tree demo
#app
.row
.col-3
.mb-2
button.btn.btn-primary(@click="collapseAll") collapse all
button.btn.btn-primary.ml-1(@click="expandAll") expand all
Tree(:data="tree1data" draggable cross-tree)
div(slot-scope="{data, store}")
template(v-if="!data.isDragPlaceHolder")
b(v-if="data.children && data.children.length" @click="store.toggleOpen(data)") {{data.open ? '-' : '+'}}&nbsp;
@davay42
davay42 / spectral.css
Created September 19, 2018 20:07
CSS gradients
.spectrum-background {
background:
linear-gradient(red, transparent),
linear-gradient(to top left, lime, transparent),
linear-gradient(to top right, blue, transparent);
background-blend-mode: screen;
}
.plaid-background {
background: