- open mongod.conf
sudo nano /etc/mongod.conf
- Comment security
#security:
# authroization: "enabled"
sudo nano /etc/mongod.conf
#security:
# authroization: "enabled"
# This is a slightly modified version of Mojave (10.14) script located in /etc/bashrc_Apple_Terminal | |
# modified to work with zsh. | |
# It mainly calls update_terminal_cwd when changing the working directory, which prints a special | |
# invisible string that Apple Terminal interprets and updates the current term title accordingly. | |
# Note : this script is useless for macOS Catalina and newer versions of macOS, since it should | |
# already contain at least this functionality. | |
# Instructions | |
# Place this file in /etc/ (alongside bash_Apple_Terminal) |
# PROMPT | |
# default macOS prompt is: \h:\W \u\$ | |
# assemble the prompt string PS1 | |
# inspired from: https://stackoverflow.com/a/16715681 | |
function __build_prompt { | |
local EXIT="$?" # store current exit code | |
# define some colors |
/* Native Error types https://mzl.la/2Veh3TR */ | |
const nativeExceptions = [ | |
EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError | |
].filter((except) => typeof except === 'function') | |
/* Throw native errors. ref: https://bit.ly/2VsoCGE */ | |
function throwNative(error) { | |
for (const Exception of nativeExceptions) { | |
if (error instanceof Exception) throw error | |
} |
/* Helper buddy for removing async/await try/catch litter 🗑 */ | |
function O_o(promise) { | |
return promise.then(data => { | |
if (data instanceof Error) return [data] | |
return [null, data] | |
}).catch(err => [err]) | |
} | |
/* Look ma, no try/catch */ | |
async function usageExample(params) { |
#!/usr/bin/env bash | |
echo " | |
---------------------- | |
NODE & NPM | |
---------------------- | |
" | |
# add nodejs 10 ppa (personal package archive) from nodesource | |
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - |
In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.
Here's one way to set it up:
npm init -y
in your project folder (don't skip this step!)npm install terser
Now, to minify a file called like_button.js
, run in the terminal:
/** | |
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
* It was requested to be introduced at as part of the jsonwebtoken library, | |
* since we feel it does not add too much value but it will add code to mantain | |
* we won't include it. | |
* | |
* I create this gist just to help those who want to auto-refresh JWTs. | |
*/ | |
const jwt = require('jsonwebtoken'); |