@RyanCavanaugh posted a fun quiz on Twitter:
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
module.exports = function transformer(file, api) { | |
const j = api.jscodeshift; | |
const ast = j(file.source); | |
ast.find(j.CallExpression, { | |
callee: { | |
name: 'require' | |
} | |
}).forEach(path => { | |
const args = path.node.arguments; |
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
module.exports = function transformer(file, api) { | |
const j = api.jscodeshift; | |
const ast = j(file.source); | |
ast.find(j.CallExpression, { | |
callee: { | |
name: 'define' | |
} | |
}).forEach(path => { | |
const args = path.node.arguments; |
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 path = require('path'); | |
module.exports = class EmitAllPlugin { | |
constructor(opts = {}) { | |
this.ignorePattern = opts.ignorePattern || /node_modules/; | |
} | |
shouldIgnore(path) { | |
return this.ignorePattern.test(path); | |
} |
When the resolver is working through its version of the node module resolution algorithm, it has to perform a large number of file system operations to determine what an ambiguous require/import string is. This means, every extension webpack needs to look for can drastically increase the number of disk hits necessary when enhanced-resolve
is attempting to locate an import.
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 jsdom = require("jsdom").jsdom; | |
const doc = jsdom(undefined, { url: "http://localhost" }); | |
const jsdomWindow = doc.defaultView; | |
global.document = doc; | |
global.window = new Proxy(jsdomWindow, { | |
set(target, property, value) { | |
global[property] = value; | |
return value; | |
} |
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 window = { | |
a: 1 | |
}; | |
global = new Proxy(global, { | |
get(target, prop, receiver) { | |
if (target[prop] !== undefined) { | |
return target[prop]; | |
} | |
return window[prop]; |
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
// Determine which `assert.x` methods are used in a codebase | |
// Run with jscodeshift using the --dry option | |
export default function transformer(file, api) { | |
const { jscodeshift: j, stats} = api; | |
const root = j(file.source); | |
root.find(j.CallExpression, { | |
callee: { | |
object: { name: 'assert' } |
So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode!
Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.
But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.
NewerOlder