Most of us know that Grunt is a really nice javascript task runner. Here you'll find a Grunt setup for a project with sass and javascript.
- A grunt setup for javascript and sass files
- Quick javascript watcher
| /** | |
| * Lighting Director | |
| * | |
| * Source: https://github.com/tslagle13/SmartThings/blob/master/Director-Series-Apps/Lighting-Director/Lighting%20Director.groovy | |
| * | |
| * Current Version: 2.9.4 | |
| * | |
| * | |
| * Changelog: | |
| * Version - 1.3 |
| /** | |
| * We have 3 states for which our page can be in: | |
| * 1. First page of form | |
| * 2. In-Between first and last pages of form | |
| * 3. Last page of form | |
| * Based on these page states, the form previous and next | |
| * buttons become enabled or disabled | |
| */ | |
| applicationState: { | |
| first: { |
| @mixin breakpoint($point) | |
| @if $point == lg | |
| @media (min-width: 1200px) | |
| @content | |
| @else if $point == md | |
| @media (min-width: 992px) and (max-width: 1199px) | |
| @content | |
| @else if $point == sm |
General
| window.onscroll = function() { | |
| var d = document.documentElement; | |
| var offset = d.scrollTop + window.innerHeight; | |
| var height = d.offsetHeight; | |
| console.log('offset = ' + offset); | |
| console.log('height = ' + height); | |
| if (offset >= height) { | |
| console.log('At the bottom'); |
| // This matches any <iframe> that is used to overlay content. | |
| // | |
| // Example: | |
| // | |
| // <iframe style="... z-index ..."></iframe> | |
| @media screen and (max-width: $media-mobile-max) | |
| iframe[style*="z-index"] | |
| display: none |
| /** | |
| * Responsive mixin. The media breakpoints are as defined | |
| * in the twitter bootstrap framework: | |
| * | |
| * - phone | |
| * - tablet-portrait | |
| * - tablet-landscape-desktop | |
| * - large-desktop | |
| * | |
| * Additional parameters for tagetting retina and non-retina |
| General | |
| 1. Site uses a cache buster for expiring .js, .css, and images | |
| 2. JavaScript and CSS is minified and concatenated into logical groupings | |
| 3. Images have been optimized by ImageOptim (http://imageoptim.com/) | |
| Markup | |
| 1. Code does not contain inline JavaScript event listeners |
| //return an array of objects according to key, value, or key and value matching | |
| function getObjects(obj, key, val) { | |
| var objects = []; | |
| for (var i in obj) { | |
| if (!obj.hasOwnProperty(i)) continue; | |
| if (typeof obj[i] == 'object') { | |
| objects = objects.concat(getObjects(obj[i], key, val)); | |
| } else | |
| //if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not) | |
| if (i == key && obj[i] == val || i == key && val == '') { // |