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
#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 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 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 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 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 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
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
// 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
#!/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 |
OlderNewer