About
This is a collection of recipes that I gather from various sources.
It is NOT a replacement for the official docs. I maintain them at a “best effort” basis.
I also provide links to official references in these recipes whenever applicable.
Enjoy, and may the source be with you 🦄.
const rafraf = (callback) => { | |
if (!window.requestAnimationFrame) {return null;} | |
return window.requestAnimationFrame(() => | |
window.requestAnimationFrame(callback) | |
); | |
}; |
// Assume `dispatch` and `fetchFromNetwork` are defined elsewhere. | |
// ## 1. CPS With Nodebacks | |
// This is the old-school-style fetch. Mostly here for | |
// historical reasons. | |
// | |
// Yet, contrary to the arguments against using it, | |
// it‘s not that hard to maintain this code when you are | |
// careful and know what you are doing. |
docker run -i -t --name nodejs ubuntu:latest /bin/bash
So here, -i
stands for interactive mode and -t
will allocate a pseudo terminal for us.
Some more trivia about these flags.
# | |
# Needless to say, I (Volkan Ozcelik) take no responsibility, whatsoever, | |
# about what will happen to your NAS when you try these. | |
# When did it to mine, I observed *ENORMOUS* performance gain and a zen-like silence. | |
# | |
# +----------------------------------------------------------+ | |
# | WHAT YOU ARE GOING TO DO CAN LIKELY VOID YOUR WARRANTY | | |
# | SO PROCEED WITH CAUTION | | |
# +----------------------------------------------------------+ | |
# |
This gist outlines the change in the depth and breadth of the tasks and responsibilities of a software engineer as she continuously improves herself.
I created this to supplement a discussion in an internal slack group; then I though the rest of the world might benefit from this too.
Contributions are always welcome.
- Knowledge
# <type>: (If applied, this commit will...) <subject> (Max 50 char) | |
# |<---- Using a Maximum Of 50 Characters ---->| | |
# Explain why this change is being made | |
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->| | |
# Provide links or keys to any relevant tickets, articles or other resources | |
# Example: Github issue #23 |
/*! | |
* Copyright 2015 Google Inc. All rights reserved. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
This gist is no longer in use.