Skip to content

Instantly share code, notes, and snippets.

View ptiswitz's full-sized avatar
🐻

Julien Léger ptiswitz

🐻
  • Nurun
  • Montreal
View GitHub Profile
@ptiswitz
ptiswitz / regex-url-catcher
Last active August 29, 2015 14:23
Regex to catch url and extract protocol, domain, path and query string
/(?:(https?):\/\/)((?:[\w\-\.]+))([\w\/\-\._]+)?(?:\?([\w\-_=&]+))?/g
@ptiswitz
ptiswitz / random-between.js
Created July 7, 2015 12:16
Function to make a random selection between two values
function randomBetween(val1, val2) {
return Math.round(Math.random()) ? val1 : val2;
}
((global) => {
let database;
global.addEventListener('activate', () => {
database = new ydn.db.Storage('webfolio', {
stores: [{
name: 'building-blocks',
keyPath: 'id',
indexes: [{
name: 'eventId',