Skip to content

Instantly share code, notes, and snippets.

@AntMooreWebDev
AntMooreWebDev / slugify.js
Last active May 21, 2019 09:16 — forked from mathewbyrne/slugify.js
Javascript Slugify
function Slugify(string) {
const a = 'àáäâãåèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;'
const b = 'aaaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------'
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(/[^\w\-]+/g, '') // Remove all non-word characters
.replace(/\-\-+/g, '-') // Replace multiple - with single -
@AntMooreWebDev
AntMooreWebDev / comma-snippet.js
Last active May 11, 2019 14:05 — forked from ashcdev/comma-snippet.js
Convert Checkboxes or Similar into Comma Separated list
var checkedVals = $('input[type=checkbox]:checked').map(function() {
return this.value;
}).get().join(",");
$(*TARGET*).val(checkedVals);
@AntMooreWebDev
AntMooreWebDev / Typeahead-BS3-css.css
Last active June 2, 2021 03:24 — forked from bhays/Typeahead-BS3-css
Bootstrap 3 style fixes for using Typeahead.js
.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
margin-bottom: 0;
}
.tt-hint {
display: block;
width: 100%;
height: 38px;
padding: 8px 12px;