// test-code.js
add :: (number, number) => number
function add (x, y) {
return x + y
}
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
| const { group } = require('@webpack-blocks/core') | |
| module.exports = happypack | |
| function happypack (blocks) { | |
| return group(blocks.map(happyfyBlock)) | |
| } | |
| /** | |
| * Returns a new block wrapping `block` that creates a happypack loader config. |
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
| // With merge helper: | |
| module.exports = function exampleBlock () { | |
| return (context, { merge }) => merge({ | |
| module: { | |
| rules: [ | |
| { | |
| test: context.fileType('text/css'), | |
| use: ['sample-css-loader'] | |
| } |
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
| const webpackMerge = require('webpack-merge') | |
| module.exports = { | |
| merge, | |
| addLoader, | |
| addPlugin | |
| } | |
| function merge (configSnippet) { | |
| return prevConfig => webpackMerge.smart(prevConfig, configSnippet) |
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
| // src/plugins/dctypes.js | |
| import { types as tt } from "../tokenizer/types"; | |
| import { types as ct } from "../tokenizer/context"; | |
| import Parser from "../parser"; | |
| import "./flow"; | |
| const pp = Parser.prototype; | |
| export default function (instance) { |
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
| { | |
| "version": "0.0.0", | |
| "scripts": { | |
| "to-comments": "babel --plugins=@andywer/babel-plugin-transform-dctypes-comments --no-babelrc test-code.js", | |
| "to-flow": "babel --plugins=@andywer/babel-plugin-transform-dctypes-to-flow --no-babelrc test-code.js", | |
| "to-flow-runtime": "NODE_ENV=development babel --plugins=@andywer/babel-plugin-transform-dctypes-to-flow,flow-runtime --no-babelrc test-code.js" | |
| }, | |
| "dependencies": { | |
| "@andywer/babel-cli-dctypes": "7.0.0-alpha.1", | |
| "@andywer/babel-plugin-transform-dctypes-comments": "^0.1.0", |
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
| { | |
| "scripts": { | |
| "test": "mocha" | |
| }, | |
| "engines": { | |
| "node": ">= 7.0" | |
| }, | |
| "devDependencies": { | |
| "leakage": "./path/to/local/leakage/branch/feature/async-support", | |
| "mocha": "^3.2.0", |
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
| // counter.js | |
| import stateful from 'new-fancy-statefulness' | |
| const Counter = (props, state, { setState }) => ( | |
| <div> | |
| <div>Clicked {state.clicks} times</div> | |
| <button onClick={props.onClick}>Increase +</button> | |
| </div> | |
| ) |
This is a proposal for lightning talk at Reactive Conf. Please 🌟 this gist to push the proposal!
Hi, I am Andy, creator of leakage - the node-powered memory leak testing library.
Instead of manual debugging it provides a structured approach to fix or even prevent memory leaks.
const fetchData = thread(require('worker-loader!./fetch-data'))
// or
const fetchData = thread(async url => {
return (await fetch(url)).json()
})
// fetchData :: ThenableObservable
const data = await fetchData('/api/me')