Skip to content

Instantly share code, notes, and snippets.

Avatar
💜
He4rt Developers Evangelist

Daniel Reis DanielHe4rt

💜
He4rt Developers Evangelist
View GitHub Profile
@codeguy
codeguy / slugify.js
Created Sep 24, 2013
Create slug from string in Javascript
View slugify.js
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@nmicht
nmicht / CodeSniffer with pre-commit.md
Last active Jan 29, 2021
Force PHP standards with Git hooks and Code Sniffer
View CodeSniffer with pre-commit.md

Force PHP standards with Git hooks and Code Sniffer

Phpcs Dependency

First, we need a development dependency specified to install phpcs. It looks something like this:

{
    "require-dev": [
        "squizlabs/php_codesniffer": "2.0.*@dev"
    ]
}