This file contains hidden or 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 debounce = function(func, wait) { | |
| // we need to save these in the closure | |
| var timeout, args, context, timestamp; | |
| return function() { | |
| // save details of latest call | |
| context = this; | |
| args = [].slice.call(arguments, 0); | |
| timestamp = new Date(); |
This file contains hidden or 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
| ;(function() { | |
| // Used to resolve the internal `[[Class]]` of values | |
| var toString = Object.prototype.toString; | |
| // Used to resolve the decompiled source of functions | |
| var fnToString = Function.prototype.toString; | |
| // Used to detect host constructors (Safari > 4; really typed array specific) | |
| var reHostCtor = /^\[object .+?Constructor\]$/; |
This file contains hidden or 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 sheet = (function() { | |
| // Create the <style> tag | |
| var style = document.createElement('style'); | |
| // Add a media (and/or media query) here if you'd like! | |
| // style.setAttribute('media', 'screen') | |
| // style.setAttribute('media', 'only screen and (max-width : 1024px)') | |
| // WebKit hack :( | |
| style.appendChild(document.createTextNode('')); |
This file contains hidden or 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
| function matchesSelector(el, selector) { | |
| var p = Element.prototype; | |
| var f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector || function(s) { | |
| return [].indexOf.call(document.querySelectorAll(s), this) !== -1; | |
| }; | |
| return f.call(el, selector); | |
| } | |
| // Usage | |
| matchesSelector(document.getElementById('myDiv'), 'div.someSelector[some-attribute=true]') |
This file contains hidden or 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
| // jQuery example | |
| // http://osvaldas.info/examples/detecting-css-animation-transition-end-with-javascript/oncssanimationend.js | |
| $( '.item' ).addClass( 'disappear' ).onCSSAnimationEnd( function() | |
| { | |
| $( this ).remove(); | |
| }); | |
| // JavaScript example | |
| // http://osvaldas.info/examples/detecting-css-animation-transition-end-with-javascript/jquery.oncssanimationend.js | |
| var item = document.querySelector( '.item' ); |
This file contains hidden or 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
| function isValidEmail(string){ | |
| string = string||''; | |
| var lastseg = (string.split('@')[1]||'').split('.')[1]||'', | |
| input = document.createElement('input'); | |
| input.type = "email"; | |
| input.required = true; | |
| input.value = string; | |
| return !!(string && (input.validity && input.validity.valid) && lastseg.length); | |
| } |
This file contains hidden or 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
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // Breakpoint (v2.5.0) | |
| // Modular Scale (v2.1.1) | |
| // ---- | |
| @import "modular-scale"; | |
| @import "breakpoint"; |
This file contains hidden or 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
| <button class="btn btn--primary">Primary button</button> | |
| <button class="btn btn--secondary">Secondary button</button> |
This file contains hidden or 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
| <button class="btn btn--primary">Primary button</button> | |
| <button class="btn btn--secondary">Secondary button</button> |
This file contains hidden or 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> | |
| <button class="button button--small button--default">Small button</button> | |
| <button class="button button--small button--success">Small success button</button> | |
| <button class="button button--small button--warning">Small warning button</button> | |
| <button class="button button--small button--danger">Small danger button</button> | |
| <button class="button button--small button--info">Small info button</button> | |
| </div> | |
| <div> | |
| <button class="button button--default">Medium button</button> |