- Jul 2023
-
datatracker.ietf.org datatracker.ietf.org
-
soundcloud.com soundcloud.com
-
thesephist.com thesephist.com
Tags
Annotators
URL
-
-
blog.phronemophobic.com blog.phronemophobic.com
-
learn.svelte.dev learn.svelte.dev
Tags
Annotators
URL
-
-
blog.logrocket.com blog.logrocket.com
-
blog.logrocket.com blog.logrocket.com
-
jonasclaes.be jonasclaes.be
-
developers.cloudflare.com developers.cloudflare.com
-
kit.svelte.dev kit.svelte.dev
-
kit.svelte.dev kit.svelte.dev
Tags
Annotators
URL
-
-
github.com github.com
-
www.netlify.com www.netlify.com
-
blog.logrocket.com blog.logrocket.com
Tags
Annotators
URL
-
-
geoffrich.net geoffrich.net
-
```html
<script> let counter = 0; let evens = 0; $: { if (counter > 10) { break $; } if (counter % 2 === 0) { evens++; } } </script><button on:click={() => (counter++)}> Increment </button>
Counter: {counter}, evens before 10: {evens}
```
Tags
Annotators
URL
-
-
kit.svelte.dev kit.svelte.dev
Tags
Annotators
URL
-
-
svelte.dev svelte.dev
-
-
developer.chrome.com developer.chrome.com
-
-
www.youtube.com www.youtube.com
-
www.youtube.com www.youtube.com
-
openmls.tech openmls.techOpenMLS1
-
-
matrix.org matrix.org
Tags
Annotators
URL
-
-
arewemlsyet.com arewemlsyet.com
-
-
www.thestack.technology www.thestack.technology
-
datatracker.ietf.org datatracker.ietf.org
-
datatracker.ietf.org datatracker.ietf.org
-
blog.mozilla.org blog.mozilla.org
-
www.ietf.org www.ietf.org
-
Tags
Annotators
URL
-
-
datatracker.ietf.org datatracker.ietf.org
-
blog.cloudflare.com blog.cloudflare.com
-
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
moochinaboutltd.bandcamp.com moochinaboutltd.bandcamp.com
-
soundcloud.com soundcloud.com
-
www.youtube.com www.youtube.comYouTube2
Tags
- remix
- house
- swing
- musicbrainz:series=bda50a36-9aa0-4726-a04a-964ccfed1140
- bart&baker
- musicbrainz:release=db64a1d7-8cf6-4ff3-b53b-b8a2cbfd7d2a
- electro
- verve
- nu jazz
- musicbrainz:release=05de8b57-0ea2-47ca-a1ff-52d1404ebaf1
- musicbrainz:series=87fbcf98-7ce7-4211-a152-2892d9e1cb9c
- mix
- music
Annotators
URL
-
-
soundcloud.com soundcloud.com
-
gist.github.com gist.github.com
-
pwa-workshop.js.org pwa-workshop.js.org
-
-
gist.github.com gist.github.com
-
```js / * twitter-entities.js * This function converts a tweet with "entity" metadata * from plain text to linkified HTML. * * See the documentation here: http://dev.twitter.com/pages/tweet_entities * Basically, add ?include_entities=true to your timeline call * * Copyright 2010, Wade Simmons * Licensed under the MIT license * http://wades.im/mons * * Requires jQuery /
function escapeHTML(text) { return $('<div/>').text(text).html() }
function linkify_entities(tweet) { if (!(tweet.entities)) { return escapeHTML(tweet.text) }
// This is very naive, should find a better way to parse this var index_map = {} $.each(tweet.entities.urls, function(i,entry) { index_map[entry.indices[0]] = [entry.indices[1], function(text) {return "<a href='"+escapeHTML(entry.url)+"'>"+escapeHTML(text)+"</a>"}] }) $.each(tweet.entities.hashtags, function(i,entry) { index_map[entry.indices[0]] = [entry.indices[1], function(text) {return "<a href='http://twitter.com/search?q="+escape("#"+entry.text)+"'>"+escapeHTML(text)+"</a>"}] }) $.each(tweet.entities.user_mentions, function(i,entry) { index_map[entry.indices[0]] = [entry.indices[1], function(text) {return "<a title='"+escapeHTML(entry.name)+"' href='http://twitter.com/"+escapeHTML(entry.screen_name)+"'>"+escapeHTML(text)+"</a>"}] }) var result = "" var last_i = 0 var i = 0 // iterate through the string looking for matches in the index_map for (i=0; i < tweet.text.length; ++i) { var ind = index_map[i] if (ind) { var end = ind[0] var func = ind[1] if (i > last_i) { result += escapeHTML(tweet.text.substring(last_i, i)) } result += func(tweet.text.substring(i, end)) i = end - 1 last_i = end } } if (i > last_i) { result += escapeHTML(tweet.text.substring(last_i, i)) } return result
} ```
Tags
Annotators
URL
-
-
stackoverflow.com stackoverflow.com
-
```html <img src="invalid_link" onerror="this.onerror=null;this.src='https://placeimg.com/200/300/animals';"
```
-
-
developer.mozilla.org developer.mozilla.org
-
```js if (navigator.mediaDevices) { console.log("getUserMedia supported.");
const constraints = { audio: true }; let chunks = [];
navigator.mediaDevices .getUserMedia(constraints) .then((stream) => { const mediaRecorder = new MediaRecorder(stream);
visualize(stream); record.onclick = () => { mediaRecorder.start(); console.log(mediaRecorder.state); console.log("recorder started"); record.style.background = "red"; record.style.color = "black"; }; stop.onclick = () => { mediaRecorder.stop(); console.log(mediaRecorder.state); console.log("recorder stopped"); record.style.background = ""; record.style.color = ""; }; mediaRecorder.onstop = (e) => { console.log("data available after MediaRecorder.stop() called."); const clipName = prompt("Enter a name for your sound clip"); const clipContainer = document.createElement("article"); const clipLabel = document.createElement("p"); const audio = document.createElement("audio"); const deleteButton = document.createElement("button"); clipContainer.classList.add("clip"); audio.setAttribute("controls", ""); deleteButton.textContent = "Delete"; clipLabel.textContent = clipName; clipContainer.appendChild(audio); clipContainer.appendChild(clipLabel); clipContainer.appendChild(deleteButton); soundClips.appendChild(clipContainer); audio.controls = true; const blob = new Blob(chunks, { type: "audio/ogg; codecs=opus" }); chunks = []; const audioURL = URL.createObjectURL(blob); audio.src = audioURL; console.log("recorder stopped"); deleteButton.onclick = (e) => { const evtTgt = e.target; evtTgt.parentNode.parentNode.removeChild(evtTgt.parentNode); }; }; mediaRecorder.ondataavailable = (e) => { chunks.push(e.data); }; }) .catch((err) => { console.error(`The following error occurred: ${err}`); });
} ```
-
-
developer.mozilla.org developer.mozilla.org
-
```js const canvas = document.querySelector("canvas");
// Optional frames per second argument. const stream = canvas.captureStream(25); const recordedChunks = [];
console.log(stream); const options = { mimeType: "video/webm; codecs=vp9" }; const mediaRecorder = new MediaRecorder(stream, options);
mediaRecorder.ondataavailable = handleDataAvailable; mediaRecorder.start();
function handleDataAvailable(event) { console.log("data-available"); if (event.data.size > 0) { recordedChunks.push(event.data); console.log(recordedChunks); download(); } else { // … } } function download() { const blob = new Blob(recordedChunks, { type: "video/webm", }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; a.href = url; a.download = "test.webm"; a.click(); window.URL.revokeObjectURL(url); }
// demo: to download after 9sec setTimeout((event) => { console.log("stopping"); mediaRecorder.stop(); }, 9000); ```
-
-
www.w3.org www.w3.org
Tags
Annotators
URL
-
-
developers.google.com developers.google.com
-
soundcloud.com soundcloud.com
-
jperiod.bandcamp.com jperiod.bandcamp.com
-
jperiod.bandcamp.com jperiod.bandcamp.com
-
soundcloud.com soundcloud.com
-
github.com github.com
-
That is because React.StrictMode renders the component twice (as it is intentional), that causes 2 connections get created. Create a ws connection inside useEffect and close on the effect cleanup would help or remove StrictMode from index file.
It's not a bug, it's a feature - they say.
React DX is so special...
-
-
www.kianmusser.com www.kianmusser.com
-
datatracker.ietf.org datatracker.ietf.org
-
portaltabs.etsi.org portaltabs.etsi.org
-
webapp.etsi.org webapp.etsi.org
Tags
Annotators
URL
-
-
www.dtechy.com www.dtechy.com
Tags
Annotators
URL
-
-
berlin.ccc.de berlin.ccc.de
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
js export default { async tail(events) { fetch("https://example.com/endpoint", { method: "POST", body: JSON.stringify(events), }) } }
-
-
soundcloud.com soundcloud.com
-
www.youtube.com www.youtube.com
-
danielrotter.at danielrotter.at
-
stackoverflow.com stackoverflow.com
-
developer.chrome.com developer.chrome.com
-
remembersthe90s.bandcamp.com remembersthe90s.bandcamp.com
-
remembersthe90s.bandcamp.com remembersthe90s.bandcamp.com
-
remembersthe90s.bandcamp.com remembersthe90s.bandcamp.com
-
remembersthe90s.bandcamp.com remembersthe90s.bandcamp.com
-
remembersthe90s.bandcamp.com remembersthe90s.bandcamp.com
-
deepfriedmusic.bandcamp.com deepfriedmusic.bandcamp.com
-
-
www.builder.io www.builder.io
Tags
Annotators
URL
-
-
Tags
Annotators
URL
-
-
www.youtube.com www.youtube.com
-
-
www.skcript.com www.skcript.com
Tags
Annotators
URL
-
-
javascript.plainenglish.io javascript.plainenglish.io
-
soundcloud.com soundcloud.com
-
wiki.haskell.org wiki.haskell.org
-
twitter.com twitter.com
-
Displays game as a holographic 3D model.
Tags
Annotators
URL
-
-
github.com github.com
-
Turns a DS game into a holographic 3D image that floats above your controller.
Tags
Annotators
URL
-
-
legendapp.com legendapp.com
Tags
Annotators
URL
-
-
legendapp.com legendapp.com
Tags
Annotators
URL
-
-
twitter.com twitter.com
Tags
Annotators
URL
-
-
blog.axlight.com blog.axlight.com
-
codedamn.com codedamn.com
Tags
Annotators
URL
-
-
housemasters1.bandcamp.com housemasters1.bandcamp.com
-
developers.cloudflare.com developers.cloudflare.com
-
bash curl --request PUT \ --url https://api.cloudflare.com/client/v4/accounts/account_identifier/workers/scripts/script_name/schedules \ --header 'Content-Type: application/json' \ --header 'X-Auth-Email: ' \ --data '[{'\''cron'\'': '\''*/30 * * * *'\''}]'
-
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
``` wrangler dev --test-scheduled
$ curl "http://localhost:8787/__scheduled?cron=++++*" ```
-
-
developers.cloudflare.com developers.cloudflare.com
-
js export default { async scheduled(event, env, ctx) { ctx.waitUntil(doSomeTaskOnASchedule()); }, };
-
-
cv.iptc.org cv.iptc.org
-
-
show.newscodes.org show.newscodes.org
-
www.iptc.org www.iptc.org
-
datatracker.ietf.org datatracker.ietf.org
-
-
-
developer.mozilla.org developer.mozilla.org
-
A labeled statement is any statement that is prefixed with an identifier. You can jump to this label using a break or continue statement nested within the labeled statement
Using a labeled continue with for loops
``js // The first for statement is labeled "loop1" loop1: for (let i = 0; i < 3; i++) { // The second for statement is labeled "loop2" loop2: for (let j = 0; j < 3; j++) { if (i === 1 && j === 1) { continue loop1; } console.log(
i = ${i}, j = ${j}`); } }// Logs: // i = 0, j = 0 // i = 0, j = 1 // i = 0, j = 2 // i = 1, j = 0 // i = 2, j = 0 // i = 2, j = 1 // i = 2, j = 2 ```
Using a labeled break with for loops
```js let i, j;
// The first for statement is labeled "loop1" loop1: for (i = 0; i < 3; i++) { // The second for statement is labeled "loop2" loop2: for (j = 0; j < 3; j++) { if (i === 1 && j === 1) { break loop1; } console.log(
i = ${i}, j = ${j}
); } }// Logs: // i = 0, j = 0 // i = 0, j = 1 // i = 0, j = 2 // i = 1, j = 0 ```
Using a labeled continue statement
```js // Numbers from 1 to 100 const items = Array.from({ length: 100 }, (_, i) => i + 1)); const tests = [ { pass: (item) => item % 2 === 0 }, { pass: (item) => item % 3 === 0 }, { pass: (item) => item % 5 === 0 }, ]; let itemsPassed = 0;
itemIteration: for (const item of items) { for (const test of tests) { if (!test.pass(item)) { continue itemIteration; } }
itemsPassed++; }
js // Numbers from 1 to 100 const items = Array.from({ length: 100 }, (_, i) => i + 1)); const tests = [ { pass: (item) => item % 2 === 0 }, { pass: (item) => item % 3 === 0 }, { pass: (item) => item % 5 === 0 }, ]; let itemsPassed = 0;
for (const item of items) { let passed = true; for (const test of tests) { if (!test.pass(item)) { passed = false; break; } } if (passed) { itemsPassed++; } } ```
Using a labeled break statement
```js // Numbers from 1 to 100 const items = Array.from({ length: 100 }, (_, i) => i + 1)); const tests = [ { pass: (item) => item % 2 === 0 }, { pass: (item) => item % 3 === 0 }, { pass: (item) => item % 5 === 0 }, ]; let allPass = true;
itemIteration: for (const item of items) { for (const test of tests) { if (!test.pass(item)) { allPass = false; break itemIteration; } } } ```
Using a labeled block with break
```js foo: { console.log("face"); break foo; console.log("this will not be executed"); } console.log("swap");
// Logs: // "face" // "swap" ```
-
-
letsbuildui.dev letsbuildui.dev
-
chromestatus.com chromestatus.com
-
Adds "previousslide" and "nextslide" actions to the existing Media Session API.
This will enable developers of video conferencing websites to handle these actions from browser UI. For example, if the user puts their slides presentation into a picture-in-picture window, the browser could display buttons for navigating through slides. When the user clicks those, the website handles them through the Media Session API.
-
-
googlechrome.github.io googlechrome.github.io
-
```js let slideNumber = 1;
togglePipButton.addEventListener("click", async () => { try { if (video !== document.pictureInPictureElement) await video.requestPictureInPicture(); else await document.exitPictureInPicture(); } catch (error) { log(
> Argh! ${error}
); } });try { navigator.mediaSession.setActionHandler("previousslide", () => { log('> User clicked "Previous Slide" icon.'); if (slideNumber > 1) slideNumber--; updateSlide(); }); } catch (error) { log('Warning! The "previousslide" media session action is not supported.'); }
try { navigator.mediaSession.setActionHandler("nextslide", () => { log('> User clicked "Next Slide" icon.'); slideNumber++; updateSlide(); }); } catch (error) { log('Warning! The "nextslide" media session action is not supported.'); }
/ Picture-in-Picture canvas /
const canvas = document.querySelector("canvas"); canvas.width = 1024; canvas.height = 512; updateSlide();
const video = document.createElement("video"); video.srcObject = canvas.captureStream(); video.muted = true; video.play();
/ Utils /
function updateSlide() { const ctx = canvas.getContext("2d"); ctx.fillStyle = "grey"; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = "white"; ctx.font = "100px Google Sans,arial,sans-serif"; ctx.textAlign = "center"; ctx.textBaseline = "middle"; ctx.fillText(
slide ${slideNumber}
, canvas.width / 2, canvas.height / 2, canvas.width); } ```
-
-
git-annex.branchable.com git-annex.branchable.com
-
-
soundcloud.com soundcloud.com
-
firefox-source-docs.mozilla.org firefox-source-docs.mozilla.org
-
onlinelibrary.wiley.com onlinelibrary.wiley.com
-
alexplescan.com alexplescan.com
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
github.com github.com
-
```python from flask import Flask, request from collections import defaultdict import re import random
GREEN ="🟩" YELLOW ="🟨" WHITE ="⬜"
def get_answers(): with open("allowed_answers.txt") as f: answers = set(l for l in f.read().splitlines() if l) return answers
def get_guesses(): guesses = get_answers() with open("allowed_guesses.txt") as f: for l in f.read().splitlines(): if l: guesses.add(l) return guesses
app = Flask(name, static_folder="static") app.answers = get_answers() app.guesses = get_guesses() word = random.choice(list(app.answers)) print(f"The word is {word}")
def with_header(content): return f"""
<html> <head> <link rel="search" type="application/opensearchdescription+xml" title="searchGame" href="http://searchgame:5000/static/opensearch.xml" /> </head> <body> {content} </body></html>"""
@app.route("/") def home(): return with_header("
Right click on the address bar to install the search engine.
")@app.route("/search") def search(): return with_header(f"Content: {request.args.get('q')}")
def to_result(guess, answer): chars = [WHITE] * 5 count = defaultdict(int) for idx, (g, a) in enumerate(zip(guess, answer)): if g == a: chars[idx] = GREEN else: count[a] += 1
for idx, g in enumerate(guess): if g in count and count[g] > 0 and chars[idx] == WHITE: chars[idx] = YELLOW count[g] -= 1 return "".join(chars)
def maybe_error(guess): if len(guess) < 5: return f"less than 5 characters" if len(guess) > 5: return f"greater than 5 characters" if guess not in app.guesses: return f"not in wordlist" return None
@app.route("/game") def game(): query = request.args.get("q") guesses = [x for x in re.split("[. ]", query) if x] response = [] if not guesses: response.append("Enter 5-letter guesses separated by spaces") else: most_recent = guesses[-1] # Don't show "too short" error for most recent guess if len(most_recent) < 5: guesses = guesses[:-1] if not guesses: response.append("Enter a wordle guess") for guess in guesses[::-1]: error = maybe_error(guess) if error is None: result = to_result(guess, word) s = f"{guess} | {result}" if result == GREEN * 5: s = f"{s} | CORRECT!" response.append(s) else: response.append(f"{guess} | ERROR: {error}")
return [query, response]
```
-
-
developer.chrome.com developer.chrome.com
-
vinyldigger.bandcamp.com vinyldigger.bandcamp.com
Tags
Annotators
URL
-
-
hip-hopthegoldenera.bandcamp.com hip-hopthegoldenera.bandcamp.com
-
hip-hopthegoldenera.bandcamp.com hip-hopthegoldenera.bandcamp.com
-
earlyradiohistory.us earlyradiohistory.us
-
recnet.com recnet.com
Tags
Annotators
URL
-
-
recnet.com recnet.com
Tags
Annotators
URL
-
-
recnet.com recnet.com
Tags
Annotators
URL
-
-
fccdata.org fccdata.org
-
-
cloudflare.tv cloudflare.tv
-
minitel.us minitel.us
-
www.edc4it.com www.edc4it.com
-
^@ :
Ctrl
+Shift
+2
-
-
soundcloud.com soundcloud.com
-
gtfobins.github.io gtfobins.github.io
Tags
Annotators
URL
-
-
gtfobins.github.io gtfobins.github.ioGTFOBins1
-
-
stackoverflow.com stackoverflow.com
-
js 'good_luck_buddy'.split(/_(.*)/s) ['good', 'luck_buddy', ''] // ignore the third element
-
-
soundcloud.com soundcloud.com
-
www.youtube.com www.youtube.com
-
github.com github.com
-
```js // Getting details on a Threads user and outputting it to the console
const getUserDetails = async (username) => { let userInfo = await threads.getUserData(username); console.log( "",
Name: ${userInfo.full_name}\n
,Bio: ${userInfo.biography}\n
,ID: ${userInfo.user_id}\n
,Followers: ${userInfo.follower_count}\n
,Website: ${userInfo.bio_links[0].url}
); } getUserDetails("Gisgar3"); ```
Tags
Annotators
URL
-