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
def derive_relations(derived_down, target, relations): | |
for down, up in relations: | |
if target == down: | |
if (derived_down, up) in relations: | |
continue | |
if derived_down: | |
relations.append((derived_down, up)) | |
derive_relations(target, up, relations) | |
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
const pipeActions = reducer => (...actions) => { | |
const getStateAfterActions = (state, actionToExecute, ...actions) => { | |
return actionToExecute ? | |
getStateAfterActions(reducer(state, actionToExecute), ...actions) : | |
state; | |
}; | |
return getStateAfterActions(undefined, ...actions); | |
}; |
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
// Example: node --experimental-modules update_dep.mjs <package_dir_path> | |
import fs from 'fs'; | |
import path from 'path'; | |
const packageJsonPath = path.join(process.argv[2], './package.json'); | |
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); | |
const packageNames = Object.keys(packageJson.dependencies).filter(name => name.startsWith('@adespresso/')); |
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 | |
for package_json_path in `find ./packages -name package.json`; do | |
eslint_content="{ | |
\"rules\": { | |
\"import/no-extraneous-dependencies\": [ | |
\"error\", | |
{ | |
\"packageDir\": \"${package_json_path//package.json}\", | |
\"devDependencies\": [\"**/*.test.js\", \"**/*.stories.js\"] |
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
/** | |
* | |
* Install global modules: yarn global add typescript ts-node | |
* Install image utility libraries: npm i svgson calipers calipers-png | |
* Launch with ts-node ex: | |
* curl -sL <script_shortlink> -o ./c.ts && ts-node <path_to_sticker_folder> && rm ./c.ts | |
* | |
**/ | |
const { promisify } = require('util') |