Skip to content

Instantly share code, notes, and snippets.

View modestotech's full-sized avatar

Max Modesto Wallin modestotech

View GitHub Profile
@modestotech
modestotech / setup-linux.sh
Last active May 16, 2019 19:18 — forked from blaedj/setup.sh
simple Ubuntu Linux setup script
#TO USE: Run the following:
# sudo curl -fsSkL http://gist.githubusercontent.com/blaedj/11387166/raw/352c44464e0db63afb9f375b887942f5676bfcda/setup.sh | sh
#install git
sudo apt-get install git
#install zsh
apt-get install zsh
chsh -s /bin/zsh
@modestotech
modestotech / package.json
Last active January 22, 2019 10:53
Webpack dev server problem
{
"name": "client",
"version": "4.1.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --mode development",
"prebuild": "npm run cleanbuild",
"build": "webpack --mode production",
"postbuild": " cpr dist ../../PublishFiles/Web -o",
@modestotech
modestotech / Bash
Last active November 13, 2018 19:46
# Find all ocurrences of filter and map and style the output a bit
find src/ -type f -name '*.js' -exec awk '/filter\(|map\(/{printf "%-100s%-5s%-100s\n", FILENAME, FNR, $0}' {} +
@modestotech
modestotech / Redirecting all requests to index.html
Created October 18, 2018 08:16
There is a problem with webpack-dev-server that makes so that all calls that are not root (/) goes to the backend and produces a 404 error. The solution is to redirect all calls to index.html.
// The snippet below achieves in a Node backend what
// "historyApiFallback: true" flag achieves on a webpack-dev-server environment.
// By redirecting all requests to index.html, the routing contained in the frontend app
// takes care of redirecting to the right place
const viewRouter = require('./routes/view');
app.use('/',viewRouter);
router.route('/*')
.get((req,res)=>res.sendFile(path.resolve(__dirname, '../dist', 'index.html')));