Skip to content

Instantly share code, notes, and snippets.

View michaelpumo's full-sized avatar
👽
Abducted by Aliens

Michael Pumo michaelpumo

👽
Abducted by Aliens
View GitHub Profile
{
"basics": {
"name": "Thomas Edison",
"label": "Inventor and Businessman",
"picture": "https://example.com/photo.jpg",
"email": "thomas.edison@example.com",
"phone": "(123) 456-7890",
"website": "https://thomasedison.com",
"summary": "Prolific inventor and businessman known for developing many devices that greatly influenced life around the world, including the phonograph, the motion picture camera, and the electric light bulb.",
"location": {
@michaelpumo
michaelpumo / slugify.js
Created July 28, 2017 16:38
A utility function for turning a string into a slugged version.
function slugify (text) {
const special = 'ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a·/_,:;'
const ordinary = 'AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa------'
const p = new RegExp(special.split('').join('|'), 'g')
return text.toString().toLowerCase()
.replace(/\s+/g, '-')
.replace(p, c => ordinary.charAt(special.indexOf(c)))
.replace(/&/g, '-and-')
.replace(/[^\w-]+/g, '')