docker run --name recorder-redis -p 6379:6379 -d redis:alpine
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
// 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 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 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 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
// polyfill for webpacks' require.ensure() | |
// credit: https://github.com/webpack/webpack/issues/183#issuecomment-169186696 | |
// | |
let proto = Object.getPrototypeOf(require) | |
!proto.hasOwnProperty('ensure') && Object.defineProperties(proto, { | |
'ensure': { | |
value: function ensure (modules, callback) { | |
callback(this) | |
}, | |
writable: false |
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
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) { |
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 express = require('express') | |
const sassMiddleware = require('node-sass-middleware') | |
const app = express() | |
app.use(sassMiddleware({ | |
/* Options */ | |
src: path.join(__dirname, '../public/scss'), | |
response: true, | |
debug: true, |
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
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) |
docker run -d -p 11211:11211 --name cache memcached:alpine
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
Before: | |
=============================== Coverage summary =============================== | |
Statements : 95.78% ( 590/616 ) | |
Branches : 89.75% ( 473/527 ) | |
Functions : 92.16% ( 47/51 ) | |
Lines : 96.78% ( 541/559 ) | |
================================================================================ | |
After: |
NewerOlder