Printing instructions:
- Duplex
- short edge for A5 booklet
- long edge for A6 booklet
- X pages per side, so if you're printing on A4 sheets:
- 2 pages per side for A5 booklet (~21×15 mm)
- 4 pages per side for A6 booklet (~10×15 mm)
UNIT=MM | |
BORDER=NONE,#000000,0,MARKDOT,#000000 | |
GAP=5,5,ON | |
PAGE=210,297,PORTRAIT,HV | |
DPI=300 | |
CARDSIZE=63,88 | |
LINK=cards.xls,image | |
IMAGE=,[IMAGE],0,0,100%,100%,0,PTA |
UNIT=MM | |
BORDER=NONE,#000000,0,MARKDOT,#000000 | |
GAP=10,10,ON | |
PAGE=210,297,PORTRAIT,HV | |
DPI=300 | |
CARDSIZE=40,55 | |
LINK=cards.xls,image | |
IMAGE=,[IMAGE],0,0,100%,100%,0,PTA |
create-react-app
globally, and how to run scripts (npm start
, npm test
, npm run whatever
…)… | |
const category = useSelector(state => state.app.currentCategory); | |
const asyncFunction = React.useCallback( | |
category ? () => getProducts(category) : null, | |
[category] | |
); | |
const [error, loading, products] = useAsync(asyncFunction, category); | |
… |
import * as React from 'react'; | |
// TODO inject counters | |
const Counter = () => { | |
const [value, setValue] = React.useState(1); | |
const incr = React.useCallback(() => setValue(value + 1), [value]); | |
return ( | |
<button type="button" onClick={incr}> | |
Click to incr. ({value}) |
const { promisify } = require('util') | |
const delay = promisify(setTimeout) | |
const pad = (s, len = 4) => s.length >= len ? s : pad(`0${s}`, len) | |
// 300 tasks (id for log, run for action) | |
const tasks = [] | |
for (let i = 0; i < 300; i++) { | |
const id = String(i) | |
const run = () => delay(2000 + Math.random() * 8000) | |
tasks.push({ id, run }) |
import React, { Fragment, Component } from 'react'; | |
import ReactDOM from 'react-dom'; | |
class ContextData { | |
watchers = [] | |
constructor(initialState = {}) { | |
this.state = initialState |
Usage : node scan-dependencies.js <path>
<path>
(a project is a folder with package.json
file, himself not inside a node_modules
directory)npm install
then npm outdated
from project*.js
files and check for missing require(…)
for every dependencyShitty code, version 1:
const concat = s => s.reduce((r,s) => r + s)
const mult = (a, b) => a * b
const foo = a => b => c => concat([c, ' = ', mult(a, b)])
const bar = a => Number(a) + 1
const baz = b => b ? 42 : 33
const res = foo(1)('bar')('baz')
console.log(res)