Skip to content

Instantly share code, notes, and snippets.

View eimfach's full-sized avatar
💭
https://www.robingruenke.com/journal/blogging/tools/how-my-journal-is-build.html

Robin Gruenke eimfach

💭
https://www.robingruenke.com/journal/blogging/tools/how-my-journal-is-build.html
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active April 19, 2024 14:42
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
def f(diff, n):
"""
This function returns the new difficulty.
"""
period_count = (n + 1) // 100000
return max(diff + 2**(period_count - 1), 5000)
diff = 6232935860523 # starting diffculty
blocknumber = 200000 # starting blocknumber
numberOfBlocks2years = 2*365*24*60*60/15
@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@patrickarlt
patrickarlt / build.sh
Last active March 25, 2020 04:42
ES 7 async/await demo!
babel github-es6.js -o github.js --optional runtime --experimental
@p3t3r67x0
p3t3r67x0 / pseudo_elements.md
Last active January 16, 2024 01:17
A CSS pseudo-element is used to style specified parts of an element. In some cases you can style native HTML controls with vendor specific pseudo-elements. Here you will find an list of cross browser specific pseudo-element selectors.

Styling native elements

Native HTML controls are a challenge to style. You can style any element in the web platform that uses Shadow DOM with a pseudo element ::pseudo-element or the /deep/ path selector.

video::webkit-media-controls-timeline {
  background-color: lime;
}

video /deep/ input[type=range] {
@g-P
g-P / print_gitbook.js
Last active January 26, 2022 14:02
Print Git Books
/*
If you try to print a gitbook directly, you get nothing but the contents because of their *just* use of `@media print` styling to hide away the content section of the books.
Fret not, here is the codez:
*/
$(".book-header,.book-summary,.navigation,.book-progress").remove();
$(".book.with-summary .book-body").css('left', '0px');
$("*").css('position', 'static');
window.print()
@staltz
staltz / introrx.md
Last active April 19, 2024 18:49
The introduction to Reactive Programming you've been missing
@jeffmo
jeffmo / gist:054df782c05639da2adb
Last active January 11, 2024 06:05
ES Class Property Declarations
@marianposaceanu
marianposaceanu / linux_fun.md
Last active January 29, 2023 20:31
How to have some fun using the terminal.

Linux fun-o-matic

How to have some fun using the terminal.

  1. Install cowsay [0] via : sudo apt-get install cowsay
  2. Install fortune [1] via : sudo apt-get install fortune
  3. Make sure you have Ruby installed via : ruby -v
  4. Install the lolcat [2] via : gem gem install lolcat
  5. Profit!
@dustintheweb
dustintheweb / stock-android-browser-check.js
Created July 8, 2013 22:03
Check if the browser user agent is the stock android browser.
// Stock Android Browser Check >>>>>>>>>>>>>>>>
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1 && ua.indexOf("mobile") && ua.indexOf("chrome")==-1
if(isAndroid) {
// stuff
}