Skip to content

Instantly share code, notes, and snippets.

View wklsh's full-sized avatar

Shawn Lim Wee Kiang wklsh

View GitHub Profile
@wklsh
wklsh / header.css
Created August 17, 2018 03:05
Prevent elements from shifting around on hover / active text bolds
a:hover {
font-weight:bold;
}
a::after {
display: block;
content: attr(data-text);
font-weight: bold;
height: 0;
overflow: hidden;
@wklsh
wklsh / slugify.js
Created November 6, 2017 10:17 — 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
}