Skip to content

Instantly share code, notes, and snippets.

View rdub80's full-sized avatar

Roland Dubois rdub80

View GitHub Profile
@hagemann
hagemann / slugify.js
Last active September 4, 2024 02:45
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;'
const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------'
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
@jduff
jduff / base.css
Created September 6, 2010 16:08
base css file
/* base.css */
/* http://carsonified.com/blog/design/setting-rather-than-resetting-default-styling/ */
/* http://developer.yahoo.com/yui/fonts/ */
/* http://developer.yahoo.com/yui/base/ */
/* Font Reset from YUI http://developer.yahoo.com/yui/fonts
If you want this size in pixels (px) Declare this percent (%)
10 77
11 85