justify is longer than align ⇒ longer means horizontal, so align means vertical by exclusion.
justify is often used with text, and text is horizontal, so justify is horizontal, align is vertical by exclusion.
| #!/bin/sh | |
| set -e | |
| VM_NAME=vm-ubuntu-dev | |
| [ ! -f ~/.ssh/id_rsa.pub ] && ssh-keygen -b 4096 -t rsa | |
| SSH_KEY=$(cat ~/.ssh/id_rsa.pub) | |
| tee ~/$VM_NAME.yaml >/dev/null <<EOF |
| #!/bin/sh | |
| # Calculates a metric of how many `any`'s are there compared to line count for TypeScript codebase (in percents) | |
| # Basically we count all `any` occurences, then count all lines in the codebase, and lastly divide one by another | |
| echo "scale = 4; $(find -name "*.ts?" -not -path "./node_modules/*" | xargs grep -o '\bany\b' | wc -l) * 100 / $(find -name "*.ts?" -not -path "./node_modules/*" | xargs wc -l | tail -1 | awk '{print $1}')" | bc |
| function move(el, distance, duration) { | |
| let startTime; | |
| function recur() { | |
| window.requestAnimationFrame((time) => { | |
| if (startTime === undefined) { | |
| startTime = time; | |
| } | |
| const elapsed = time - startTime; | |
| const fraction = elapsed / duration; | |
| const dx = Math.min(distance, distance * fraction); |
| // Custom promise-based compose | |
| const composeWithPromise = (...args) => | |
| R.composeWith((f, val) => { | |
| if (val && val.then) { | |
| return val.then(f); | |
| } | |
| if (Array.isArray(val) && val.length && val[0] && val[0].then) { | |
| return Promise.all(val).then(f); | |
| } | |
| return f(val); |
| const MongoClient = require('mongodb').MongoClient; | |
| const uri = 'mongodb://localhost:27017/'; | |
| const mongoClient = new MongoClient(uri, { | |
| useNewUrlParser: true, | |
| useUnifiedTopology: true, | |
| }); | |
| (async () => { | |
| const connection = await mongoClient.connect(); |
| function heavyFunc() { | |
| const limit = Math.pow(10, 8); | |
| let res = 0; | |
| for (let i = 1; i < limit; i++) { | |
| res += Math.atan2(i, i) * Math.random(); | |
| } | |
| return res; | |
| } | |
| async function heavyFuncWithAsync() { |
| /** | |
| * Разные асинхронные паттерны в JS, решающие одну и ту же задачу | |
| */ | |
| ///////////////// callbacks /////////////////////////////////// | |
| function asyncFunction(callback) { | |
| setTimeout(callback.bind(this, 42), 100); | |
| } | |
| asyncFunction(console.log.bind(this, 'asyncFunction:')); |
| const readline = require('readline'); | |
| const questions = [ | |
| ['Can the fox be recursive?', 'O_o'], | |
| ['Can readline be non-recursive?', 'Yep'] | |
| ]; | |
| const cmd = readline.createInterface({ | |
| input: process.stdin, | |
| output: process.stdout |
| const readline = require('readline'); | |
| const questions = [ | |
| ['What does the fox say?', 'Yeeeee'], | |
| ['Will you be coding this weekend?', 'Whaaaatt?!'] | |
| ]; | |
| const cmd = readline.createInterface({ | |
| input: process.stdin, | |
| output: process.stdout |