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
function slugify(string) { | |
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;' | |
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------' | |
const p = new RegExp(a.split('').join('|'), 'g') | |
return string.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters | |
.replace(/&/g, '-and-') // Replace & with 'and' | |
.replace(/[^\w\-]+/g, '') // Remove all non-word characters |
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
/* -------------------------------------------------------------------------- */ | |
// All Bootstrap 4 Sass Mixins [Cheat sheet] | |
// Updated to Bootstrap v4.5.x | |
// @author https://anschaef.de | |
// @see https://github.com/twbs/bootstrap/tree/master/scss/mixins | |
/* -------------------------------------------------------------------------- */ | |
// Grid variables | |
$grid-columns: 12; | |
$grid-gutter-width: 30px; |
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
Vue.directive("uppercase", { | |
twoWay: true, | |
// TODO: unbind | |
unbind: () => {}, | |
bind: function (el, binding, vnode) { | |
const findVModelName = vnode => { | |
try { | |
// https://forum.vuejs.org/t/solved-how-can-you-update-the-v-model-from-a-custom-directive-in-vue-2/2275 | |
return vnode.data.directives.find(o => { | |
return o.name === "model"; |
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
// Changes XML to JSON | |
// Modified version from here: http://davidwalsh.name/convert-xml-json | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; | |
if (xml.nodeType == 1) { // element | |
// do attributes | |
if (xml.attributes.length > 0) { |
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
/** | |
Problem: | |
You have a javascript array that likely has some duplicate values and you would like a count of those values. | |
Solution: | |
Try this schnippet out. | |
*/ | |
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
Show hidden characters
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"jquery": true | |
}, | |
"extends": [ | |
"airbnb", | |
"plugin:vue/recommended", | |
], |
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
#!/bin/bash | |
files=$(git diff --cached --name-only | grep '\.jsx\?$') | |
# Prevent ESLint help message if no files matched | |
if [[ $files = "" ]] ; then | |
exit 0 | |
fi | |
failed=0 | |
for file in ${files}; do |
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
.particleJs | |
background-color transparent | |
width 35% | |
height 100% | |
display block | |
position absolute | |
top 0px | |
left 0px |
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
# detect `$rvm_path` | |
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ] | |
then rvm_path="${HOME:-}/.rvm" | |
fi | |
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ] | |
then rvm_path="/usr/local/rvm" | |
fi | |
# load environment of current project ruby | |
if |
NewerOlder