My favorite sorting algorithm.
A Pen by Gerald Fullam on CodePen.
My favorite sorting algorithm.
A Pen by Gerald Fullam on CodePen.
| /* Based on: http://stackoverflow.com/a/901144/2502532 */ | |
| var getParam = function(key) { | |
| key = key.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); | |
| var val = window.location.search.match(new RegExp('[\\?&]' + key + '=([^&#]*)')); | |
| return val === null ? '' : decodeURIComponent(val[1].replace(/\+/g, ' ')); | |
| }; | |
| console.log(getParam('foo')); |
| // Source: http://stackoverflow.com/a/13455920/2502532 | |
| // ------------------------------------------------------------------- | |
| // Add prototype for 'window.location.query([source])' which contain an object | |
| // of querystring keys and their values | |
| // ------------------------------------------------------------------- | |
| if(!window.location.query) { | |
| window.location.query = function(source){ | |
| var map = {}; | |
| source = source || this.search; |
| content = content | |
| // Replace hypen, if between number, with en-dash | |
| .replace(/(\d+)-(\d+)/ig, '$1–$2') | |
| // Replace hypen, if between spaces, with em-dash | |
| .replace(/( +)-+( +)/ig, '$1—$2') | |
| // Replace smart double quotes with straight double quotes | |
| .replace(/“|”|„|‟|″|‶/ig, '"') | |