This is a curated set of conventions and best practices for Stylus, an expressive, dynamic, robust and advanced CSS preprocessor. Frustrated with there not being a set of conventions set in place (that could be easily found), I set forth to find out on my own.
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
How to have some fun using the terminal.
- Install cowsay [0] via :
sudo apt-get install cowsay
- Install fortune [1] via :
sudo apt-get install fortune
- Install figlet [3] via :
sudo apt-get install figlet
- Make sure you have Ruby installed via :
ruby -v
- Install the lolcat [2] via : gem
gem install lolcat
- (option) Add to .bash_profile and/or .bashrc
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 { ObjectOmit } from 'typelevel-ts' | |
const get = <O, K extends keyof O>(k: K, o: O): O[K] => o[k] | |
const set = <O, K extends keyof O>(k: K, v: O[K], o: O): O => Object.assign({}, o, { [k as any]: v }) | |
const remove = <O, K extends keyof O>(k: K, o: O): ObjectOmit<O, K> => { | |
const copy: any = Object.assign({}, o) | |
delete copy[k] | |
return copy |
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
function addComments(arg, name) { | |
// 当参数前的注释不存在的情况, 加入 webpackChunkName 注释 | |
if (!arg.leadingComments) { | |
arg.leadingComments = [ | |
{ | |
type: 'CommentBlock', | |
value: ` webpackChunkName: '${name}' `, | |
}, | |
] | |
} |
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
TypeScript 21 hrs 47 mins ████████████████▒░░░ 67.1% | |
Vue.js 6 hrs 21 mins ██████▓░░░░░░░░░░░░░ 19.6% | |
JSON 2 hrs 10 mins ████▒░░░░░░░░░░░░░░░ 6.7% | |
JavaScript 46 mins ███▒░░░░░░░░░░░░░░░░ 2.4% |
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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
OlderNewer