This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fetchfail.js | |
// Getting incorrect results on node 22.3.0 | |
async function main() { | |
const blobUrl = 'https://socketusercontent.com/blob/QW5l4aR3idwMbxhuLo6o2qaGCUBz5YwKg1ikl7QZaajw' | |
const res = await fetch(blobUrl, { | |
method: 'GET' | |
}) | |
const bytes = await res.arrayBuffer() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en-us" dir="ltr" itemscope itemtype="http://schema.org/Article"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="description" content="A resource for developers looking to put HTML5 to use today, including information on specific features and when to use them in your apps."> | |
<meta name="keywords" content="html5,html 5,html5 demos,html5 examples,javascript,css3,notifications,geolocation,web workers,apppcache,file api,filereader,indexeddb,offline,audio,video,drag and drop,chrome,sse,mobile"> | |
<title>Yo Polymer – A Whirlwind Tour Of Web Component Tooling - HTML5Rocks Updates</title> | |
<script type='text/javascript'>window.mod_pagespeed_start = Number(new Date());</script><link rel="shortcut icon" href="http://www.html5rocks.com/favicon.ico"> | |
<link rel="alternate" type="application/rss+xml" title="HTML5Rocks RSS" href="http://feeds.feedburner.com/html5rocks"/> | |
<link rel="stylesheet" media="all" href="http://www.html5rocks.com/static/css/base.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@media (prefers-color-scheme: dark) { | |
#main a { color: #bfdfff; } | |
body { background-color: #292a2d; } | |
#main a:hover { background-color: #000000; } | |
#main a:hover { color: #80ecff; } | |
#main a:hover { box-shadow: 0 0 7px #0080ff; } | |
#main a:hover { box-shadow: 0 0 7px #0080ff; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fp from 'fastify-plugin' | |
import path from 'path' | |
import desm from 'desm' | |
const __dirname = desm(import.meta.url) | |
/** | |
* This plugins adds fastify-static | |
* | |
* @see https://github.com/fastify/fastify-static |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fp from 'fastify-plugin' | |
import Fastify from 'fastify' | |
/** | |
* This plugins adds promethius metrics | |
* | |
* @see https://gitlab.com/m03geek/fastify-metrics | |
*/ | |
export default fp(async function (fastify, opts) { | |
fastify.register(import('fastify-metrics'), {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { someAsyncTask } from 'a-library' | |
async function doSomething () { | |
try { | |
const results = await someAsyncTask(); | |
const betterResults = results.map(stuff => { betterStuff: stuff }); | |
return results; | |
} catch (error) { | |
if (error instanceof Error){ | |
console.error(error.message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0x2000d583cfc8919912e5C1eBb4B5C2c346e7324A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"folders": | |
[ | |
{ | |
"path": ".", | |
} | |
], | |
"settings": { | |
"project_syntaxes": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generate a random integer r with equal chance in min <= r < max. | |
function randomInt(min, max) { | |
var range = max - min; | |
if (range <= 0) { | |
throw new Exception('max must be larger than min'); | |
} | |
var requestBytes = Math.ceil(Math.log2(range) / 8); | |
if (!requestBytes) { // No randomness required | |
return min; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://ballpit.github.io/website/pics.zip | |
const fs = require('fs') | |
const get = require('simple-get') | |
const pump = require('pump') | |
const path = require('path') | |
get('https://ballpit.github.io/website/pics.zip', (err, res) => { | |
if (err) throw err |
NewerOlder