Skip to content

Instantly share code, notes, and snippets.

View johnnyperkins's full-sized avatar
🤘
Droppin' dem bits

Johnny Perkins johnnyperkins

🤘
Droppin' dem bits
  • transdimensional
View GitHub Profile
@johnnyperkins
johnnyperkins / slugify.js
Created May 7, 2018 20:24 — forked from hagemann/slugify.js
Slugify makes a string URI-friendly
function slugify(string) {
const a = 'àáäâãèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;'
const b = 'aaaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------'
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
@johnnyperkins
johnnyperkins / cloudSettings
Last active May 14, 2018 05:17
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-05-14T05:17:50.005Z","extensionVersion":"v2.9.2"}
@johnnyperkins
johnnyperkins / ledger_nano_s_on_linux.md
Last active January 22, 2018 06:50 — forked from diffficult/ledger_nano_s_on_linux.md
Ledger Nano S on Arch

Ledger Nano S on Linux

Requirement:

  • Ledger Nano
  • Ledger HW1
  • Ledger Nano S
  • Ledger Blue
  • Special Edition

You need to create a set of udev rules to allow access to the device on Linux. This can be done easily by running the following command:

@johnnyperkins
johnnyperkins / gist:9317e5f6e9116d8254d1248d7775b0fc
Created January 22, 2018 00:56
Close if click outside panel
$("body").click(function(e) {
if ($(e.target).closest('.catalog-side-panel > ul').length === 0 && $(e.target).closest(sidebarBtn).length === 0) {
toggleSidebarNav("close");
}
});