Skip to content

Instantly share code, notes, and snippets.

Avatar
💾
Will code for food

Matej dekadentno

💾
Will code for food
View GitHub Profile
@dekadentno
dekadentno / task.md
Last active Oct 1, 2019
Frontend developer task
View task.md

Frontend developer task

Make a Github clone using the Github API (https://developer.github.com/v3/). The design is optional, but the look and feel has to be different from the current Github design.

The app will have 3 routes:

  • /home
  • /search
  • /user/:username
@dekadentno
dekadentno / pre-commit.sh
Last active May 16, 2019
pre commit hook
View pre-commit.sh
#!/bin/sh
#yorkie 2.0.0
command_exists () {
command -v "$1" >/dev/null 2>&1
}
has_hook_script () {
[ -f package.json ] && cat package.json | grep -q "\"$1\"[[:space:]]*:"
}
@dekadentno
dekadentno / eslint.md
Last active May 16, 2019
eslint config for my vue projects
View eslint.md

Required VSCode plugins:

  • ESLint
  • Vetur
  • Prettier is NOT necessary to be installed

IMPORTANT:

  • don't put the .vscode folder (with the settings.json file) in the gitignore file:

There are 2 files and 1 user settings file that have to be edited:

@dekadentno
dekadentno / 1_primitive_comparison.js
Last active Apr 1, 2019 — forked from nicbell/1_primitive_comparison.js
JavaScript object deep comparison.Comparing x === y, where x and y are values, return true or false. Comparing x === y, where x and y are objects, returns true if x and y refer to the same object. Otherwise, returns false even if the objects appear identical.Here is a solution to check if two objects are the same.
View 1_primitive_comparison.js
//Primitive Type Comparison
var a = 1;
var b = 1;
var c = a;
console.log(a == b); //true
console.log(a === b); //true
console.log(a == c); //true
console.log(a === c); //true
@dekadentno
dekadentno / vue.config.js
Created Mar 15, 2019
vue config example working with purge css and terser (uglify / uglifyjs)
View vue.config.js
/**
npm i --save-dev terser-webpack-plugin purgecss @fullhuman/postcss-purgecss purgecss-webpack-plugin glob-all path
*/
const TerserPlugin = require('terser-webpack-plugin')
const PurgecssPlugin = require('purgecss-webpack-plugin')
const glob = require('glob-all') // required for purgecss
const path = require('path') // re quired for purgecss
...
@dekadentno
dekadentno / purgecss.js
Last active Mar 15, 2019
Vue CLI 3 + PurgeCSS
View purgecss.js
/**
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');
@dekadentno
dekadentno / retry-queue.js
Created Mar 8, 2019
My backup of a javascript async queue implementation by Bolerodan on CodeSandbox. All regards to him.
View retry-queue.js
// the retry service
// retry-queue.js
const service = {
retryQueue: [],
onItemAddedCallbacks: [],
hasMore () {
return this.retryQueue.length > 0
},
push (retryItem) {
this.retryQueue.push(retryItem)
@dekadentno
dekadentno / bulkUnpublish.sh
Created Feb 7, 2019
Multiple packages unpublish from npm
View bulkUnpublish.sh
# 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
@dekadentno
dekadentno / googleanalytics.js
Last active Feb 1, 2019
Google analytics vue and nuxt opt in (gdpr)
View googleanalytics.js
/*
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
@dekadentno
dekadentno / joel test.md
Last active Dec 10, 2018
The Joel Test
View joel test.md

The Joel Test is a twelve-question measure of the quality of a software team.

  • Do you use source control? Yes
  • Can you make a build in one step? Yes
  • Do you make daily builds? Yes
  • Do you have a bug database? Yes
  • Do you fix bugs before writing new code? Yes
  • Do you have an up-to-date schedule? Yes
  • Do you have a spec? Yes
  • Do programmers have quiet working conditions? Yes