const result = await withCleanup(async (defer) => {
const fileHandle = await getFileHandle();
defer(() => fileHandle.close());
// Carry on
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 { crc32 } from 'common/components/Features/Experiment/crc32'; | |
import { Config } from 'common/api/models/Config'; | |
const sortBy = require('lodash.sortby'); | |
export interface Experiments { | |
[name: string]: Variant[]; | |
} | |
export interface Variant { | |
name: string; |
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
// No TypeScript | |
function add(a, b) { | |
return a + b; | |
} | |
// Type function arguments | |
// vvvvvv vvvvvv | |
function add(a: number, b: number) { | |
return a + b; | |
} |
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
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document) | |
Node.prototype.on = window.on = function (name, delegate, fn) { | |
var f | |
var target = this, match = false | |
var matches = this.matchesSelector || this.mozMatchesSelector || this.webkitMatchesSelector || this.oMatchesSelector || (function (name) { | |
$(name).forEach(function (elm) { | |
if (elm === target){ |
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
/** | |
`useChangeLog` - dev-mode helper hook to let you | |
know why a memoized component re-rendered! | |
Usage example: | |
const YourComponent = React.memo((props) => { | |
// Just drop this fella into your memo component's body. | |
useChangeLog(props); |
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
#!/usr/bin/env python3 | |
# LiteEth UDP Inter-board stream demo. | |
# | |
# Copyright (c) 2022 Florent Kermarrec <florent@enjoy-digital.fr> | |
# SPDX-License-Identifier: BSD-2-Clause | |
# ./arty.py --build --load | |
import os |
Grab ffmpeg from https://www.ffmpeg.org/download.html
It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.
The most trivial operation would be converting gifs:
ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
-crf
values can go from 4 to 63. Lower values mean better quality.-b:v
is the maximum allowed bitrate. Higher means better quality.
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
const {useCallback, useEffect, useReducer, useRef} = require('react'); | |
let effectCapture = null; | |
exports.useReducerWithEmitEffect = function(reducer, initialArg, init) { | |
let updateCounter = useRef(0); | |
let wrappedReducer = useCallback(function(oldWrappedState, action) { | |
effectCapture = []; | |
try { | |
let newState = reducer(oldWrappedState.state, action.action); |
OlderNewer