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
| const contains = (key, list) => { | |
| return list.indexOf(key) > -1; | |
| } | |
| const diff = (first, second) => { | |
| let firstKeys = Object.keys(first); | |
| let secondKeys = Object.keys(second); | |
| let addition = secondKeys.filter(key => !contains(key, firstKeys)) | |
| let deletion = firstKeys.filter(key => !contains(key, secondKeys)) | |
| return {addition, deletion} |
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 isScrolledIntoView (el) { | |
| var elemTop = el.getBoundingClientRect().top; | |
| var elemBottom = el.getBoundingClientRect().bottom; | |
| var isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight); | |
| return isVisible; | |
| } |
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
| /* | |
| * memoize.js | |
| * by @philogb and @addyosmani | |
| * with further optimizations by @mathias | |
| * and @DmitryBaranovsk | |
| * perf tests: http://bit.ly/q3zpG3 | |
| * Released under an MIT license. | |
| */ | |
| function memoize( fn ) { | |
| return function () { |
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
| if( !Object.assign ) { | |
| Object.assign = function( obj, items ) { | |
| var src = Object( items), target = Object( obj ) | |
| Object.getOwnPropertyNames( src ).forEach( function( k ) { | |
| target[ k ] = src[ k ] | |
| }) | |
| return target; | |
| } | |
| } |
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 throttle ( fn, threshhold, scope ) { | |
| threshhold || (threshhold = 250); | |
| var last, | |
| deferTimer; | |
| return function () { | |
| var context = scope || this; | |
| var now = +new Date, | |
| args = arguments; |
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 everythingIsLoaded = setInterval( function () { | |
| if ( /loaded|complete/.test( document.readyState ) ) { | |
| clearInterval( everythingIsLoaded ); | |
| // Initialize our code.. | |
| } | |
| }, 10 ); |
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
| Element.prototype.hasClass = Element.prototype.hasClass || function ( className ) { | |
| return new RegExp( ' ' + className + ' ' ).test( ' ' + this.className + ' ' ); | |
| }; | |
| Element.prototype.addClass = Element.prototype.addClass || function ( className ) { | |
| if ( !this.hasClass( className ) ) { | |
| this.className += ' ' + className; | |
| } | |
| return this; | |
| }; |
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 forEach = function (collection, callback, scope) { | |
| if (Object.prototype.toString.call(collection) === '[object Object]') { | |
| for (var prop in collection) { | |
| if (Object.prototype.hasOwnProperty.call(collection, prop)) { | |
| callback.call(scope, collection[prop], prop, collection); | |
| } | |
| } | |
| } else { | |
| for (var i = 0, len = collection.length; i < len; i++) { | |
| callback.call(scope, collection[i], i, collection); |
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 isMobile = (function(a){ | |
| return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/) |
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 prefix ( $property, $prefixes: ( webkit moz o ms ) ) { | |
| $vendor-prefixed-properties: transform background-clip background-size; | |
| $result: (); | |
| @each $prefix in $prefixes { | |
| @if index( $vendor-prefixed-properties, $property ) { | |
| $property: -#{ $prefix }-#{ $property } | |
| } | |
| $result: append($result, $property); | |
| } | |
| @return $result; |