Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Fix WontFix

guest271314

💭
Fix WontFix
View GitHub Profile
@bayotop
bayotop / last-evet-id.md
Last active Jun 28, 2022
Sending arbitrary Last-Event-ID header values across origins using the EventSource API.
View last-evet-id.md

The EventSource API

The EventSource interface is used to receive server-sent events. It connects to a server over HTTP and receives events in text/event-stream format without closing the connection.

https://developer.mozilla.org/en-US/docs/Web/API/EventSource

Last-Event-ID

Setting an ID lets the browser keep track of the last event fired so that if, the connection to the server is dropped, a special HTTP header (Last-Event-ID) is set with the new request.

@littledan
littledan / anonymous-inline-modules.md
Last active Jun 29, 2022
Anonymous inline modules
View anonymous-inline-modules.md

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;
};
@bagder
bagder / http3.php
Last active Aug 10, 2022
HTTP/3 with PHP/CURL
View http3.php
if (!defined('CURL_HTTP_VERSION_3')) {
define('CURL_HTTP_VERSION_3', 30);
}
$ch = curl_init("https://cloudflare-quic.com/");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3);
curl_exec($ch);
@spvkgn
spvkgn / opus-tools_static_build.sh
Last active Sep 10, 2022
Script to build a statically linked opus-tools
View opus-tools_static_build.sh
#!/bin/sh
# ==============================================================
# Script to build a statically linked version of opus-tools
#
# Release tarballs:
# http://downloads.xiph.org/releases/opus/
# http://downloads.xiph.org/releases/ogg/
# http://downloads.xiph.org/releases/flac/
#
@lukaslihotzki
lukaslihotzki / polyfill_worklet_import.js
Last active Oct 1, 2022
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 wrappedFunc.call(this, url);
} catch (e) {
if (e.name != 'AbortError') {
throw e;
}
// assume error is caused by https://bugzilla.mozilla.org/show_bug.cgi?id=1572644
@zed
zed / ping_pong.c
Last active Oct 16, 2022
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
* https://github.com/mdn/webextensions-examples/tree/master/native-messaging
*
* # Python 3.x version
* # Read a message from stdin and decode it.
* def getMessage():
* rawLength = sys.stdin.buffer.read(4)
* if len(rawLength) == 0:
@domenic
domenic / 1-service-worker.js
Last active Oct 20, 2022
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
Dobby233Liu / a.js
Last active Oct 23, 2022
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;
var MIN_HEX_LENGTH = 2;
class UUID {
static createUUID() {
const array = new Uint8Array(ARRAY_LENGTH);
window.crypto.getRandomValues(array);
let uuid = '';
@TotallyNotChase
TotallyNotChase / host.json
Last active Oct 24, 2022
Native Messaging - C
View host.json
{
"name": "pingpong",
"description": "Native messaging host example",
"path": "path/to/release_executable",
"type": "stdio",
"allowed_origins": [
"chrome-extension://extension_id/"
]
}
@TotallyNotChase
TotallyNotChase / host.json
Last active Oct 24, 2022
Native Messaging - Rust
View host.json
{
"name": "pingpong",
"description": "Native messaging host example",
"path": "path/to/release_executable",
"type": "stdio",
"allowed_origins": [
"chrome-extension://extension_id/"
]
}