Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

François Beaufort beaufortfrancois

🏠
Working from home
View GitHub Profile
View gist:583424dfef66be1ade86231fd1a260c7
0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application)
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Button)
0x19, 0x01, // Usage Minimum (0x01)
0x29, 0x03, // Usage Maximum (0x03)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
View gpu-buffer.diff
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc b/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc
index 9658796f2508..37a106c741f6 100644
--- a/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc
+++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc
@ -127,6 +131,25 @@ void GPUBuffer::OnMapAsyncCallback(ScriptPromiseResolver* resolver,
WTF::ArrayBufferContents::SharingType::kNotShared);
mapped_buffer_ = DOMArrayBuffer::Create(contents);
+
+ auto* script_state = resolver->GetScriptState();
View mse-promisified.js
// In an ideal world, MSE would be that simple...
const mediaSource = new MediaSource()
video.srcObject = mediaSource
await mediaSource.ready
const sourceBuffer = mediaSource.addSourceBuffer('video/mp4')
const response = await fetch('https://example.com/init.mp4')
@beaufortfrancois
beaufortfrancois / finally.js
Created Oct 10, 2017
Promise.prototype.finally vs try/catch/finally with Async/Await
View finally.js
// Promise.prototype.finally
fetch('http://foo.bar')
.then(response => console.log(response))
.catch(error => console.log(error))
.finally(_ => console.log('finally'))
// try/catch/finally with Async/Await
View pip-resize.md

Use cases

User enters PiP User resizes PiP window User exits PiP

Proposal #1

View gist:1f39f5c2572b333eeb8ce601aaed3288
Start at https://www.savethedate.foo/
---------
Puzzle #1
https://github.com/kzuse201/trailhead/blob/master/idareyou.js
-28.092472,-52.419667
5
View web-bluetooth-permissions-proposal.js
function connectDevice(device) {
return device.connectGATT()
.then(...)
}
// Simple
permissions.query({ name: 'bluetooth' })
.then(permission => {
if (permission.state != 'granted') {