I became interested in string clustering through developing fpos, a set of Python scripts for graphing my spending habits. In a clear failure of research I missed the existance of libraries like:
| function mapValues(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| result[key] = fn(obj[key], key); | |
| return result; | |
| }, {}); | |
| } | |
| function pick(obj, fn) { | |
| return Object.keys(obj).reduce((result, key) => { | |
| if (fn(obj[key])) { |
This is an example of using Tether Drop with React Portal (and Redux for managing the state). I was asked if using React Portal is redundant, as both libraries pull the content into the <body>. Using only Drop would cause an invariant violation in React becuase of the DOM mutation, so I'm using React Portal to first bring it outside without React complaining (I don't know how React Portal does it, I haven't checked out the source, but it works). Once it's out of React's supervision, I can apply Drop to it.
Dropdown.jsxis the actual dropdown componentApp.jsxis just an demo that uses it
This is my lazy way out of this limitation using an existing library that has much more features than you need, but chances are that you're going to need a library like React Portal anyway for stuff like modals.
| # ... | |
| [options] | |
| # webpack loaders | |
| module.name_mapper='.*\.css$' -> '<PROJECT_ROOT>/flow/stub/css-modules.js' | |
| module.name_mapper='.*\.\(svg\|png\|jpg\|gif\)$' -> '<PROJECT_ROOT>/flow/stub/url-loader.js' |
| #!/usr/bin/env bash | |
| set -e | |
| function usage() { | |
| set -e | |
| cat <<EOM | |
| ##### ecs-run ##### | |
| Simple script for running tasks on Amazon Elastic Container Service | |
| One of the following is required: | |
| Required arguments: |
This cheat sheet provides a detailed overview of the exposed lifecycle events and available commands (and entrypoints) of the Serverless framework, that can be hooked by plugins (internal and external ones). The document is structured by the commands invoked by the user.
Lifecycle events are shown as the globally available outer events (all providers) and sub lifecycle events that are provider specific in the called order. Currently only the AWS provider is shown. If you have information about the other provider,
| const { introspectSchema } = require("apollo-codegen"); | |
| const { executeWithOptions } = require("graphql-code-generator/dist/cli"); | |
| const fs = require("fs"); | |
| const path = require("path"); | |
| const graphqlPath = "./src/graphql/"; | |
| const schemaInput = "./src/graphql/temp.graphql"; | |
| const jsonOutput = "./src/graphql/temp.json"; | |
| const dtsOutput = "./src/graphql/domain.d.ts"; |
- Install Proxyman (https://proxyman.io/).
- Install
https-proxy-agentfrom NPM (https://www.npmjs.com/package/https-proxy-agent). - Add an agent to your fetch call so that requests get sent through Proxyman.
import ProxyAgent from 'https-proxy-agent';
export const request = async (url: string, options: RequestOptions) => fetch(url, {
...options,
agent: ProxyAgent('http://localhost:9090'), // 9090 is the default port of Proxyman (see prefs)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.