Skip to content

Instantly share code, notes, and snippets.

View wizardnet972's full-sized avatar
:octocat:
Angularing...

Shlomi Levi wizardnet972

:octocat:
Angularing...
View GitHub Profile
<app-form [user]="user$ | async"></app-form>
...
@Input() set user(value) {
if (!value) return;
this.form.patchValue({ ...value });
}
@wizardnet972
wizardnet972 / what-forces-layout.md
Created January 29, 2021 11:19 — forked from paulirish/what-forces-layout.md
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
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
@wizardnet972
wizardnet972 / Reactive-Angular-Terminology.md
Created October 16, 2020 16:20 — forked from BioPhoton/Reactive-Angular-Terminology.md
List of used terms related to reactivity in context of Angular and their description

Reactive Angular Terminology

To have a common terminology I list some of the used terms here and explain their meaning and usage.

Used terms:

  • Asynchronous/Observable Primitive
  • Reactive Primitives
  • Primitive Reactive Problems
  • Bind
  • Connect
@wizardnet972
wizardnet972 / nginx.conf
Created October 1, 2020 16:11 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@wizardnet972
wizardnet972 / axios.refresh_token.1.js
Created September 22, 2020 22:26 — forked from Godofbrowser/axios.refresh_token.1.js
Axios interceptor for refresh token when you have multiple parallel requests. Demo implementation: https://github.com/Godofbrowser/axios-refresh-multiple-request
// for multiple requests
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error);
} else {
prom.resolve(token);
I also wrote tiny CLI tool ghtopdep that just work.
It may be installed via pip pip install ghtopdep.
Tool has some options
ghtopdep --help
Usage: ghtopdep [OPTIONS] URL
Options:
--show INTEGER Number of showing repositories (default=10).
--more-than INTEGER Number of stars (default=5).
@wizardnet972
wizardnet972 / gist:21fde6b2608749d3a78377b0f0e3be45
Created June 11, 2020 10:44 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@wizardnet972
wizardnet972 / get-npm-package-version
Created June 4, 2020 14:33 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@wizardnet972
wizardnet972 / memes
Created April 25, 2020 08:44
es6 memory function
// created by @wizardnet972
function memes(fn) {
const fns = new Map();
return (...args) => {
const key = `f-${args.length}`;
if (!fns.has(key)) {
const value = fn(...args);
fns.set(key, value);