docker run -d -p 11211:11211 --name cache memcached:alpine
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
// use via | |
// jscodeshift -t all.js src | |
// | |
const sourceOptions = { quote: 'single' } | |
/** | |
* Removes the named import: PropTypes | |
*/ | |
const removeNamedImportPropTypes = (file, api) => { | |
const j = api.jscodeshift |
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
#!/bin/bash | |
# This is intended for use with create-react-app | |
#npm install -g webpack-bundle-size-analyzer | |
NODE_ENV=production webpack --config node_modules/react-scripts/config/webpack.config.prod.js --json src/index.js | webpack-bundle-size-analyzer |
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
#alpine-node is a super small distro with just the minimum to run | |
FROM mhart/alpine-node:6 | |
WORKDIR /app | |
#allow local code to mount into this directory | |
VOLUME /app | |
#move all native plugins up to -g installs and link them one level above the app | |
RUN npm install -g google-cloud && cd / && npm link google-cloud && cd /app |
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
function entries (O) { | |
var entrys = [] | |
for (var key in O) { | |
if (O.hasOwnProperty(key) && O.propertyIsEnumerable(key)) { | |
entrys.push([key, O[key]]) | |
} | |
} | |
return entrys | |
}; |
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
Show hidden characters
{ | |
"plugins": [ | |
["transform-react-jsx", { "pragma":"h" }], | |
["module-resolver", { | |
"root": ["."], | |
"alias": { | |
"react": "preact-compat", | |
"react-dom": "preact-compat" | |
} | |
}] |
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
// hack for auth0 lock component, which cannot yet be used for SSR | |
// navigator = { | |
// userAgent: "internal" | |
// }; | |
// location = { | |
// hash: '', | |
// href: 'https://local.konakb.com', | |
// protocol: 'https' | |
// }; |
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
Before: | |
=============================== Coverage summary =============================== | |
Statements : 95.78% ( 590/616 ) | |
Branches : 89.75% ( 473/527 ) | |
Functions : 92.16% ( 47/51 ) | |
Lines : 96.78% ( 541/559 ) | |
================================================================================ | |
After: |
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
var oReq = new XMLHttpRequest() | |
oReq.onload = function (e) { | |
var xhr = e.target | |
if (xhr.status === 200 && onSuccess) { | |
onSuccess(xhr.response) | |
} else if (xhr.status !== 200 && onFailure) { | |
onFailure(xhr.response) | |
} | |
} | |
oReq.open(method, action, true) |
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
function ssr(req, res, url) { | |
let user = req.user //comes from passport | |
const preloadedState = { user, url } // Compile an initial state | |
const store = configureStore(preloadedState) // Create a new Redux store instance | |
const html = render(<Provider store={store}><Html /></Provider>) // Render the component to a string | |
const finalState = store.getState() // Grab the initial state from our Redux store | |
res.send(renderFullPage(html, finalState)) // Send the rendered page back to the client | |
} | |
function renderFullPage(html, preloadedState) { |
OlderNewer