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
@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
module.exports = function(pwd, extra) {
var forge = require("node-forge");
forge.options.usePureJavaScript = true;
var EC = require('elliptic').ec;
return new Promise((resolve, reject) => {
var ec_p256 = new EC('p256');
if (!pwd)
/**
* loadData.js
*
* An utility file adapted from https://github.com/vuejs/blog/blob/master/.vitepress/getPosts.js
*
* Main change : reload posts if a change has been detected on a watched directory.
*
* The update is triggered by using 'touch' the config.js file
*
* Note : this file is located in a `utils` subfolder of the `.vitepress` folder, change the path to conform to your setup.
@sindresorhus
sindresorhus / esm-package.md
Last active August 18, 2025 16:08
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@Kaiido
Kaiido / drawImage-clipper.js
Created January 31, 2021 03:21
Safari drawImage out-of-bounds fixer
/**
* MIT License - Copyright (c) 2021 Kaiido
*
* A monkey-patch for Safari's drawImage.
*
* This browser doesn't handle well using the cropping abilities of drawImage
* with out-of-bounds values.
* (see https://stackoverflow.com/questions/35500999/cropping-with-drawimage-not-working-in-safari)
* This script takes care of detecting when the monkey-patch is needed,
* and does redefine the cropping parameters so they fall inside the source's boundaries.
@tomhicks
tomhicks / plink-plonk.js
Last active May 15, 2025 13:25
Listen to your web pages
@jabis
jabis / gun.helper.js
Last active July 15, 2023 10:48
Gun user-space and public graph get/set with signing and encryption
/**
* get and put encrypted and/or signed material to paths in Gun
* FIXME: Investigate why root level put doesn't work
*
* DONE: Add signing to make objects unwritable by others
* Changes:
* - 25.02.2020
* - added mergedeep to better merge deeper objects between themselves
* - added pair.osign option to only sign not encrypt when passing existing pairs
**/
@jabis
jabis / Sending and reading Messages with gun.js
Last active June 14, 2022 08:56
Send and receive messages with gun
/*so let's simplify you have
- your letters (all messages, yours & other peer) which you draw to DOM
- you have your outbox , when you say something, that the other person listens to with .on(...)
and adds to their letters when they arrive
- you listen with .on(...) the other peers messages and add them to letters when
they arrive
- on your send(){...} you would add the message to your letters
and to the outbox so your message can trigger the other persons .on */
class Chat {
@jessuni
jessuni / GenerateAudioWaveform
Last active July 3, 2023 05:58
Audio Oscilloscope (Frequency Byte) - w/ web audio API and canvas
// rename gist
@Dletta
Dletta / index.html
Created September 7, 2019 03:37
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>