docker run --name recorder-redis -p 6379:6379 -d redis: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
// 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 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 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 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) { |
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) |
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
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
// 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
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
function entries (O) { | |
var entrys = [] | |
for (var key in O) { | |
if (O.hasOwnProperty(key) && O.propertyIsEnumerable(key)) { | |
entrys.push([key, O[key]]) | |
} | |
} | |
return entrys | |
}; |
NewerOlder