This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="dns-prefetch" href="//www.google-analytics.com/"> | |
<zscript> | |
/*! Google Analytics */ | |
// Instructs analytics.js to use the name `zga` | |
window.GoogleAnalyticsObject = 'zga'; | |
// Creates an initial analytics() function | |
// The queued commands will be executed once analytics.js loads | |
window.zga = window.zga || function() { | |
(zga.q = zga.q || []).push(arguments) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getURL = function (url, success, error) { | |
if (!window.XMLHttpRequest) return; | |
var request = new XMLHttpRequest(); | |
request.onreadystatechange = function () { | |
if (request.readyState === 4) { | |
if (request.status !== 200) { | |
if (error && typeof error === 'function') { | |
error(request.responseText, request); | |
} | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* classList Polyfill: https://gist.github.com/k-gun/c2ea7c49edf7b757fe9561ba37cb19ca */ ; | |
(function() { | |
var trim = function(s) { | |
return s.replace(/^\s+|\s+$/g, ''); | |
}, | |
regExp = function(name) { | |
return new RegExp('(^|\\s+)' + name + '(\\s+|$)'); | |
}, | |
forEach = function(list, fn, scope) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="btn-group"> | |
<button class="cta-primary" title="Primary"><span>Primary</span><svg class="right-arrow"><use xlink:href="#right-arrow"></use></svg></button><br> | |
<button class="cta-secondary" title="Secondary"><span>Secondary</span><svg class="right-arrow"><use xlink:href="#right-arrow"></use></svg></button><br> | |
<a href="#" class="cta-tertiary" title="Tertiary"><span>Tertiary</span><svg class="right-arrow"><use xlink:href="#right-arrow"></use></svg></a> | |
</div> | |
<svg xmlns="//www.w3.org/2000/svg" width="0" height="0" display="none"><symbol id="right-arrow" viewBox="0 0 188.88 175.79"><path class="right-arrow" d="M72.9,5.4c7.1-7.1,18.9-7.1,26.2,0l69.4,69.4c7.1,7.3,7.1,19,0,26.2l-69.4,69.4c-7.3,7.3-19,7.3-26.2,0 c-9.4-9.9,11.1-37.6,20.8-62.4H12.2C5.5,108,0,102.4,0,95.8l0-18.7c0-6.8,5.5-12.3,12.2-12.3h80.5C82.6,41.4,64.3,16.4,72.9,5.4z" /></symbol></svg> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear() | |
const pick = (obj, keys) => keys.map(key => key in obj ? {[key]: obj[key]} : {}).reduce((res, prop) => Object.assign(res, prop), {}) | |
const row = { | |
'accounts.id': 1, | |
'client.name': 'John Doe', | |
'bank.code': 'MDAKW213' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
/* Block Scope */ | |
{ | |
const blockScope = `Block Scope`; | |
console.log(blockScope); | |
} | |
/* ES5 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var elements = document.querySelectorAll('div'); | |
callback = (el) => { console.log(el); }; | |
// Spread operator | |
elements[Symbol.iterator](); | |
elements.forEach(callback) //[...elements].forEach(callback); | |
// Array.from() | |
Array.from(elements, callback) //Array.from(elements).forEach(callback); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
// Public | |
public = function dataset(id, key) { | |
this.id = id; | |
this.key = key; | |
} | |
//a | |
getPublic = new public('abc', '123'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Looping Arrays */ | |
/* iteration reduction Loops */ | |
var iterations = items.length % 8; | |
i = items.length - 1; | |
while (iterations) { | |
fn(items[i--]); | |
iterations--; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add support of es6 methods to browsers that support es5 | |
if (!Array.from) | |
Array.from = function (selector) { | |
return [].slice.call(selector) | |
}; | |
if (window.NodeList && !NodeList.prototype.forEach) { | |
NodeList.prototype.forEach = Array.prototype.forEach; |
OlderNewer