Skip to content

Instantly share code, notes, and snippets.

View fpapado's full-sized avatar

Fotis Papadogeorgopoulos fpapado

View GitHub Profile
@donnut
donnut / currying.md
Last active October 28, 2023 17:58
TypeScript and currying

TypeScript and currying

In functional programming you often want to apply a function partly. A simple example is a function add. It would be nice if we could use add like:

var res2 = add(1, 3); // => 4

var add10To = add(10);
var res = add10To(5); // => 15
@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

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.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@pedpess
pedpess / jstudy.md
Last active May 31, 2022 09:48
Javascript Study Notes

Javascript Study Notes

(by @pedpess)


These are my own paper version notes meeting the digital world. They are related to my learnings from 2017-18, or just stuff I thought would be nice to keep a record during the time I was grasping some Javascript topics.

PS: Don't expect all the material here to be 100% accurate or up-to-date. If you find some part that's wrong, or missing or old, please send me a comment to fix! :)

@OliverJAsh
OliverJAsh / foo.ts
Last active November 17, 2022 10:05
TypeScript type hierarchy for `object`, primitives, `{}`, and `unknown`
/*
----------- primitive ----------
object non-nullable primitive nullable
------------- {} --------------
---------------- unknown -----------------
https://www.oreilly.com/library/view/programming-typescript/9781492037644/ch04.html
https://gist.github.com/OliverJAsh/381cd397008309c4a95d8f9bd31adcd7
*/
@mieky
mieky / github-artifacts-size.sh
Last active July 22, 2024 11:48
Get total size of artifacts in a GitHub repo
#!/bin/bash
# Calculate the total size of artifacts in GitHub repo (not visible in the UI).
# Needs token with the "repo" scope: Profile > Settings > Developer Settings > Personal access tokens
#
# Requires jq 1.6 or higher.
if [ $# -ne 1 ] || [ -z $API_TOKEN ]; then
echo "Usage: API_TOKEN=<token> $0 <org/repo>"
exit 1