- Don’t use
switchstatements (they are slow, can lead to bugs if you don’tbreakor “fail” silently when none of cases match). Use object literals instead, i.e.
// NoNo
switch (expression) {
case 'a': {
doStuff();
break;| .git | |
| .gitignore | |
| doc | |
| .yardoc | |
| coverage | |
| jsdoc | |
| tmp | |
| log | |
| README.md | |
| public/uploads/ |
| apt-get update && apt-get install -y -qq libpq-dev postgresql-server-dev-all postgresql-9.4-repack | |
| --fix-missing --no-install-recommends | |
| psql -c "CREATE EXTENSION IF NOT EXISTS pg_repack" -d $1 -U postgres |
| const arr = [ | |
| { id: "a", foo: "aaaaa", bar: "AA" }, | |
| { id: "b", foo: "bbbbb", bar: "BB" }, | |
| { id: "c", foo: "ccccc", bar: "CC" } | |
| ]; | |
| const obj = arr.reduce((sum, e) => Object.assign(sum, {[e.id]: e}), {}); |
| import Vue from 'vue'; | |
| const fireEvent = (name, ctx, args) => { | |
| ctx.data.on && ctx.data.on[name] && ctx.data.on[name].apply(null, args); | |
| } | |
| const createInput = (h, ctx, item) => ({ | |
| 'text': createTextInput, | |
| 'checkbox': createCheckboxInput | |
| }[item.type || 'text'](h, ctx, item)); |
switch statements (they are slow, can lead to bugs if you don’t break or “fail” silently when none of cases match). Use object literals instead, i.e.// NoNo
switch (expression) {
case 'a': {
doStuff();
break;| import reduce from './reduce'; | |
| import setSessionIdContext from './setSessionIdContext'; | |
| import setSessionIdCookie from './setSessionIdCookie'; | |
| import setCacheControlHeader from './setCacheControlHeader'; | |
| addEventListener('fetch', async (event) => { | |
| const { request: sourceRequest } = event; | |
| let context = {}; | |
| const targetRequest = reduce([ |
| class Person { | |
| // Potentially expensive calculation. | |
| late final netWorth = | |
| (() => Future.delayed(Duration(seconds: 2), () => 99))(); | |
| } | |
| // await person.netWorth |
| apt install -y unzip php8.3-fpm sqlite3 nodejs npm git nginx php8.3-common php8.3-xml php8.3-sqlite3 php8.3-zip | |
| php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
| php composer-setup.php | |
| php -r "unlink('composer-setup.php');" | |
| mv composer.phar /usr/local/bin/composer | |
| phpenmod dom | |
| apt install | |
| apt install | |
| phpenmod dom |
| import React, { useEffect, useRef, useState, useCallback } from 'react'; | |
| const strokeColor = 'oklch(var(--ac))'; | |
| /** | |
| * Component that serves as a progress indicator. | |
| * It shows a progress bar as if it were a border around the box. | |
| * The progress bar is a percentage of the total size of container sides length. | |
| */ | |
| export default function ProgressContainer({ |