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 express = require('express'); | |
var app = express(); | |
one = [ "La cueca pá los chilenos", | |
"Si no le gustan las cuecas", | |
"Hoy es 18 de Septiembre", | |
"Yo también voy a la ramá", | |
"Tu creis que no se ná", | |
"Yo las bailo donde sea", | |
"No bailo tanto pero tengo otra gracia", |
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
import find from "lodash/find"; | |
import compose from 'ramda/src/compose'; | |
import curry from 'ramda/src/curry'; | |
import map from 'ramda/src/map'; | |
//you can do this if you want: | |
const _ = { | |
find: find | |
} |
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
//this is bad | |
import _ from "lodash"; | |
import R from "ramda"; | |
//pretty, but as bad as before | |
import { find } from "lodash"; | |
import { compose } from "ramda"; | |
... |
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
plugins: [ | |
new webpack.optimize.UglifyJsPlugin({ | |
output: { | |
comments: false | |
}, | |
mangle: true, | |
sourcemap: false, | |
debug: false, | |
minimize: true, | |
compress: { |
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
... | |
presets: [ | |
["es2015", { loose: true }], | |
"react" | |
] | |
... |
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
... | |
presets: [ | |
["es2015", { loose: true, modules: false }], | |
"react" | |
] | |
... |
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 determineDate = () => { | |
import('moment').then((moment) => { | |
console.log(moment().format()); | |
}).catch((err) => { | |
console.log('Failed to load moment', err); | |
}); | |
} | |
determineDate(); |
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 compression = require('compression'); | |
var app = express(); | |
app.use(compression()); |
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
plugins: [ | |
new CompressionPlugin({ | |
asset: "[path].gz[query]", | |
algorithm: "gzip", | |
test: /\.js$|\.css$|\.html$/, | |
threshold: 10240, | |
minRatio: 0.8 | |
}) | |
] |
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
//this middleware serves all js files as gzip | |
app.use(function(req, res, next) { | |
var originalPath = req.path; | |
if(!originalPath.endsWith(".js")) { | |
next(); | |
return; | |
} | |
try { | |
var stats = fs.statSync(path.join("public", `${req.path}.gz`)); | |
res.append('Content-Encoding', 'gzip'); |
OlderNewer