import React from "react";
export const profile = (Component) => {
const handleRender = (
id, // the "id" prop of the Profiler tree that has just committed
phase, // either "mount" (if the tree just mounted) or "update" (if it re-rendered)
actualDuration, // time spent rendering the committed update
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 { createFlagEngine } from "@flag-engine/core"; | |
import crypto from "node:crypto"; | |
import { headers } from "next/headers"; | |
import { unstable_flag as flag } from "@vercel/flags/next"; | |
const engine = createFlagEngine([ | |
{ | |
key: "summer-sale", | |
status: "enabled", | |
strategies: [ |
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 getPokemon = async () => { | |
const response = await fetch(); | |
const data = await response.json(); | |
return data.results; | |
}; |
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
- In some countries people have only one name (https://www.liberation.fr/checknews/2019/06/17/referendum-adp-pourquoi-y-a-t-il-une-case-je-n-ai-pas-de-prenom_1734263/) |
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 { setTimeout: st } = require("timers/promises"); | |
/* | |
* Permutating the call to the timers setTimeout and the regular setTimeout permutates the order of apparition | |
* HOWEVER, "Regular promise" will always be shown first, even if declared last (micro task) | |
* setTimeout is still a macrotask then? | |
*/ | |
function main() { | |
st(0).then(() => { | |
console.log("With promise"); |
- dataset
- target (y) which what we want to optimize
- features (x1, x2, x3 etc...) that are the "inputs" or helpers to determine y
- model: predicts Y depending on the Xs and some input
- cost function: measure the errors between y and the predictions
- minimize algorithm: minimize the errors
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
# Time the last 50 files have been modified | |
git log --format=format: --name-only --since=12.month | egrep -v '^$' | sort | uniq -c | sort -nr | egrep -v '\.json$' | egrep -v '\.lock$' | egrep -v '\.md$' | head -50 |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
elem.clientLeft
,elem.clientTop
,elem.clientWidth
,elem.clientHeight
elem.getClientRects()
,elem.getBoundingClientRect()
NewerOlder