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 camelCase( s ) { | |
| return s.replace(/\-(\w)/g, function( i, m ){ | |
| return m.toUpperCase(); | |
| }); | |
| } |
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 extendDefaults(source, properties) { | |
| var property; | |
| for (property in properties) { | |
| if (properties.hasOwnProperty(property)) { | |
| source[property] = properties[property]; | |
| } | |
| } | |
| return source; | |
| } |
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.3.14) | |
| // Compass (v1.0.1) | |
| // ---- | |
| //helpers | |
| $helpers: ( | |
| fll: ( | |
| float: left | |
| ), |
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 plugin | |
| $.fn.hammer = function (event, cb) { | |
| var $el = this; | |
| var hmr = new Hammer($el.get(0)); | |
| hmr.on(event, $.proxy(cb, $el)); | |
| }; | |
| // Usage | |
| $('.some-element').hammer('tap', function (e) { | |
| console.log(e); |
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
| /* This */ | |
| if (this.scrollTop > 147) { | |
| wrap.addClass("fix-search"); | |
| } else { | |
| wrap.removeClass("fix-search"); | |
| } | |
| /* Becomes This */ | |
| wrap.toggleClass("fix-search", this.scrollTop > 147); |
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
| /* | |
| * Debug utilities | |
| * @see https://gist.github.com/mkretschek/611475412faa996ef73d | |
| */ | |
| var $dbg; | |
| (function () { | |
| $dbg = {}; | |
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
| /* | |
| * Accurately returns the height and width of the viewport | |
| * much more reliably than simply $(window).height | |
| * | |
| * Source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript | |
| */ | |
| function viewport() { | |
| var e = window, a = 'inner'; | |
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 penthouse = require('penthouse'); | |
| var Promise = require("bluebird"); | |
| var penthouseAsync = Promise.promisify(penthouse); | |
| gulp.task('critical', function(){ | |
| penthouseAsync({ | |
| url : 'http://daverupert.com/', | |
| css : './stylesheets/style.css', | |
| height: 480 | |
| }).then( function (criticalCSS){ |
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 cb = function() { | |
| var l = document.createElement('link'); l.rel = 'stylesheet'; | |
| l.href = 'small.css'; | |
| var h = document.getElementsByTagName('head')[0]; h.parentNode.insertBefore(l, h); | |
| }; | |
| var raf = requestAnimationFrame || mozRequestAnimationFrame || | |
| webkitRequestAnimationFrame || msRequestAnimationFrame; | |
| if (raf) raf(cb); | |
| else window.addEventListener('load', cb); |
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 (root, factory) { | |
| if (typeof define === 'function' && define.amd) { | |
| define(['b'], factory); | |
| } else if (typeof exports === 'object') { | |
| module.exports = factory; | |
| } else { | |
| root.amdWeb = factory(root.b); | |
| } | |
| }(this, function (b) { | |
| //your code here |