Skip to content

Instantly share code, notes, and snippets.

View jCrip's full-sized avatar
🏠
Working from home

Juan Cristobal Pazos jCrip

🏠
Working from home
  • Modyo
  • Santiago, Chile
View GitHub Profile
@jCrip
jCrip / slugify.js
Created December 23, 2020 13:18 — forked from hagemann/slugify.js
Slugify makes a string URI-friendly
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
@jCrip
jCrip / bootstrap-4-sass-mixins-cheat-sheet.scss
Last active August 27, 2020 14:59 — forked from anschaef/bootstrap-4-sass-mixins-cheat-sheet.scss
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// 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;
@jCrip
jCrip / vue-uppercase.js
Created June 12, 2020 17:24 — forked from TheTrigger/vue-uppercase.js
vuejs uppercase directive
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";
@jCrip
jCrip / xmlToJson.js
Created April 17, 2018 19:26 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
// 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) {
@jCrip
jCrip / array_dupplicate_counter.js
Created August 18, 2017 19:17 — forked from ralphcrisostomo/array_dupplicate_counter.js
Javascript: Count duplicates in an array
/**
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.
*/
@jCrip
jCrip / .eslintrc.json
Last active August 6, 2017 18:42
ESLint configuration
{
"env": {
"browser": true,
"es6": true,
"jquery": true
},
"extends": [
"airbnb",
"plugin:vue/recommended",
],
@jCrip
jCrip / commit-msg
Created April 12, 2017 16:33 — forked from wesbos/commit-msg
ESLint 3.0 Git Pre Commit Hook
#!/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
@jCrip
jCrip / HTML5 Form Validation Fallback.markdown
Last active February 6, 2017 19:44 — forked from ashblue/A-Pen-by-Ash-Blue.markdown
HTML5 Form Validation Fallback (without a library)
@jCrip
jCrip / app.styl
Created October 27, 2016 18:23 — forked from douglascorrea/app.styl
Angular Directive for Particles JS - https://github.com/VincentGarreau/particles.js
.particleJs
background-color transparent
width 35%
height 100%
display block
position absolute
top 0px
left 0px
@jCrip
jCrip / .powrc
Created August 5, 2016 20:14
Pow RVM Integration
# 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