name: tufte-viz description: | Ideate and critique data visualizations using Edward Tufte's principles from "The Visual Display of Quantitative Information." Use this skill when: (1) Designing new data visualizations or charts (2) Critiquing or improving existing visualizations (3) Reviewing dashboards or reports for graphical integrity (4) Deciding between visualization approaches (5) Reducing chartjunk or improving data-ink ratio (6) Planning small multiples or high-density displays
The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'instead ofconst foo = require('foo')to import the package. You also need to put"type": "module"in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)from CommonJS instead ofrequire(…). - Stay on the existing version of the package until you can move to ESM.
This file contains hidden or 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 lets you put constraints on assignment -- cool | |
| // - I don't know what this feature is officially called and can't find it. | |
| // for example, telling the IDE that a constant should be "even" | |
| type even = 2 | 4 | 6; | |
| const a = 2; | |
| const b: even = 2; | |
| const c: even = 4; | |
| const d: even = 3; // error: constraint violation | |
| // you can assert types, this is different! |
This file contains hidden or 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
| # Slack Block Kit Cheatsheet | |
| This is a cheatsheat for the [Block Kit API](https://api.slack.com/block-kit), great for referencing when wireframing out Slack interactions. | |
| ## Values to know | |
| ### Surfaces | |
| - [50 blocks per message](https://api.slack.com/reference/block-kit/blocks#:~:text=You%20can%20include%20up%20to,in%20modals%20or%20home%20tabs.) | |
| - [100 blocks per modal or in the home tab](https://api.slack.com/reference/block-kit/blocks#:~:text=You%20can%20include%20up%20to,in%20modals%20or%20home%20tabs.) |
This file contains hidden or 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
| /* eslint-disable no-return-assign */ | |
| const chalk = require('chalk'); | |
| const ora = require('ora'); | |
| const prettyMs = require('pretty-ms'); | |
| const throttle = require('lodash/throttle'); | |
| const getHeapUsed = throttle( | |
| () => { | |
| const heapUsed = process.memoryUsage().heapUsed / 1024 / 1024; | |
| return Math.round(heapUsed, 2); |
This file contains hidden or 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
| /* | |
| Problem | |
| We have a function that updates objects and generates audit records of the changes. | |
| Think about financial systems or just any app where it's useful to know who made changes to what. | |
| Audit records needs to be saved to the DB as well as updates to objects, but ideally | |
| we would want to execute business logic, accumulate all updates and audit records in memory | |
| and then save it to DB all at once. Let's look at the specifics. |
This file contains hidden or 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
| // based on vanilla lodash, todo: rewrite with lodash/fp | |
| // uses isPlainObject to detect ojbects to go deep into | |
| // detects circular references using Set() | |
| function mapValuesDeep(originalObj, mapFunc) { | |
| const visitedObjects = new Set() | |
| const mapValues = (originalObj, mapFunc) => | |
| _.mapValues(originalObj, value => { | |
| if (_.isPlainObject(value)) { |
This file contains hidden or 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
| // gets time now in milliseconds | |
| const msNow = () => (+new Date()) | |
| function createProgress ({ | |
| maxItems = 100, | |
| onProgressChange = () => {}, | |
| onComplete = () => {} | |
| }) { | |
| let currentProgress = 0 // % | |
| let lastProgress = 0 |
It will check if current branch is master, then ask a confirmation, in case of master branch
Articles with initial info: https://dev.ghost.org/prevent-master-push/, https://coderwall.com/p/jp7d5q/create-a-global-git-commit-hook
NewerOlder