Skip to content

Instantly share code, notes, and snippets.

View guest271314's full-sized avatar
Fix WontFix


Fix WontFix
View GitHub Profile
littledan /
Last active June 29, 2022 01:07
Anonymous inline modules

Note: this document is subsumed by the module blocks proposal

Anonymous inline modules

Anonymous inline modules are syntax for the contents of a module, which can then be imported.

let inlineModule = module {
  export let y = 1;
spvkgn /
Last active September 10, 2022 23:06
Script to build a statically linked opus-tools
# ==============================================================
# Script to build a statically linked version of opus-tools
# Release tarballs:
lukaslihotzki / polyfill_worklet_import.js
Last active October 1, 2022 14:02
Polyfill to support "import" in worklet scripts in Firefox
View polyfill_worklet_import.js
const wrappedFunc = Worklet.prototype.addModule;
Worklet.prototype.addModule = async function(url) {
try {
return await, url);
} catch (e) {
if ( != 'AbortError') {
throw e;
// assume error is caused by
domenic / 1-service-worker.js
Last active October 20, 2022 11:10
Service worker stream transferring
View 1-service-worker.js
"use strict";
const worker = new Worker("worker.js");
self.onfetch = e => {
const transform = new TransformStream(); // creates an identity transform
e.respondWith(new Response(transform.readable));
// Give the worker the writable end. An identity transform stream will just shuffle
// bytes written there into transform.readable.
Dobby233Liu / a.js
Last active October 23, 2022 08:58
my messing w/ msedge dev read aloud. ONLY RUN IN edge dev. i give up, so it wont work properly
View a.js
var ARRAY_LENGTH = 16;
class UUID {
static createUUID() {
const array = new Uint8Array(ARRAY_LENGTH);
let uuid = '';
TotallyNotChase / host.json
Last active October 24, 2022 02:01
Native Messaging - C
View host.json
"name": "pingpong",
"description": "Native messaging host example",
"path": "path/to/release_executable",
"type": "stdio",
"allowed_origins": [
zed / ping_pong.c
Last active January 30, 2023 07:05
Native messaging "ping_pong" example in C
View ping_pong.c
/*** Native messaging "ping_pong" example in C.
* It is reimplementation of the corresponding Python example from
* # Python 3.x version
* # Read a message from stdin and decode it.
* def getMessage():
* rawLength =
* if len(rawLength) == 0:
View nweb23.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
mathisonian /
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5


yashraj1120 / server.c
Created March 26, 2023 19:07
simple response server
View server.c
// webserver.c
#include <arpa/inet.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/socket.h>