Skip to content

Instantly share code, notes, and snippets.

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

Adrián adrigm

🏠
Working from home
View GitHub Profile
@adrigm
adrigm / slugify.js
Created November 16, 2018 13:31 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@adrigm
adrigm / 0_reuse_code.js
Created November 30, 2013 00:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console