Navigate to your .ssh folder and generate a ssh key. Put a name on it and a password.
ssh-keygen -t rsa
This command will generate 2 files (private and public keys):
key_name
key_name.pub
axios.interceptors.request.use(function(config) { | |
let userToken = localStorage.getItem('token'); | |
if (userToken) { | |
axios.defaults.headers.common['Authorization'] = 'Bearer ' + userToken; | |
config.headers['Authorization'] = 'Bearer ' + userToken; | |
} | |
return config; | |
}); |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
# example 1 | |
export PS1="🍔 \[\033[01;35m\]\u@\h:\[\033[01;34m\]\$(parse_git_branch) \[\033[01;32m\]\w \[\033[01;34m\]\n>\[\e[0m\]" | |
# example 2 | |
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] @ \[\033[0;36m\]\h \w\[\033[0;32m\] $(parse_git_branch)\n\[\033[0;32m\]└─\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\] ▶\[\033[0m\] ' |
#!/bin/sh | |
function lintit () { | |
e=$(eslint . --ext .vue src/*) | |
echo $e | |
if [[ "$e" != *"0 problems"* ]]; then | |
echo "ERROR: Fix eslint errors before commiting your code!" | |
exit 1 # reject | |
fi | |
} |
The Joel Test is a twelve-question measure of the quality of a software team.
/* | |
Had some problems with implementing google analytics opt-in, as in nuxt (nor vue) doesn't support that out of the box, | |
so I found a hacky method that works. | |
Idea: | |
1. user comes to the page, the famous "this page is using cookies" widget is shown | |
2. when the user clicks "accept cookies", the google analytics script should be injected into the code | |
Solution: | |
1. put your google analytics js script in the static folder of your project |
# usage: | |
# chmod 700 bulkUnpublish.sh | |
# ./bulkUnpublish.sh axios vuex moment | |
npm set registry "http://xxx.xxx.xxx.xxx" | |
for var in "$@" | |
do | |
echo "Unpublishing: $var" | |
npm unpublish --force "$var" | |
done |
// the retry service | |
// retry-queue.js | |
const service = { | |
retryQueue: [], | |
onItemAddedCallbacks: [], | |
hasMore () { | |
return this.retryQueue.length > 0 | |
}, | |
push (retryItem) { | |
this.retryQueue.push(retryItem) |
/** | |
1) npm i -D purgecss @fullhuman/postcss-purgecss purgecss-webpack-plugin glob-all path | |
2) edit vue.config.js | |
*/ | |
/** | |
** vue.config.js | |
*/ | |
const PurgecssPlugin = require('purgecss-webpack-plugin'); | |
const glob = require('glob-all'); |