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
| // Add the following to your preferences file | |
| "folder_exclude_patterns":[".git","node_modules"] |
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
| /** | |
| * Lodash / Underscore method for breaking data sets into smaller sets (chunks) | |
| * | |
| * @arguments | |
| * | |
| * collection: Array / Object | |
| * chuckSize: Number | |
| * | |
| * @example | |
| * |
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
| Object.keys = function (obj) { | |
| var keys = []; | |
| for (var key in obj) { | |
| if (obj.hasOwnProperty(key)) { | |
| keys.push(key); | |
| } | |
| } | |
| return keys; | |
| }; |
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 app = express.createServer( | |
| (function(req, res, next) { | |
| if(req.url.indexOf("/stylesheets/") === 0) { | |
| res.setHeader("Cache-Control", "public, max-age=345600"); // 4 days | |
| res.setHeader("Expires", new Date(Date.now() + 345600000).toUTCString()); | |
| } | |
| return next(); | |
| }), | |
| express.static(__dirname + '/static') | |
| ); |
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
| /** | |
| * Get content from a URL (e.g. JavaScript) using RSVP promises | |
| */ | |
| var getUrl = function (url) { | |
| var xhr = new XMLHttpRequest(); | |
| // @see https://github.com/tildeio/rsvp.js | |
| var promise = new RSVP.Promise(); | |
| xhr.open('GET', url); |
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 base64 = exports; | |
| base64.encode = function (unencoded) { | |
| return new Buffer(unencoded || '').toString('base64'); | |
| }; | |
| base64.decode = function (encoded) { | |
| return new Buffer(encoded || '', 'base64').toString('utf8'); | |
| }; |
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
| // Open Dev Tools console and enter | |
| !(function a(){ debugger; }()); | |
| // Then you should see the wrapping | |
| with ((console && console._commandLineAPI) || {}) { | |
| !(function a(){ debugger;}()) | |
| } |
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
| // dollar selector | |
| function $(C, P) { | |
| P = P || document; | |
| return /:first$/.test(C) ? (P = P.querySelector(C.slice(0, -6))) ? [P] : [] : [].slice.call(P.querySelectorAll(C)) | |
| } | |
| // simple utility to add an event listener | |
| $.on = function (CSS, parentNode, type, handler, capture) { | |
| // in case parentNode is missing | |
| if (typeof type !== 'string') { |
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
| <!DOCTYPE html> | |
| <title>Animations</title> | |
| <body> | |
| <script> | |
| function createAndAnimate(part) { | |
| var element = document.createElement('pre'); | |
| element.textContent = part; | |
| document.body.appendChild(element); | |
| element.animate( |
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(angular) { | |
| angular.module('analytics', ['ng']).service('analytics', [ | |
| '$rootScope', '$window', '$location', function($rootScope, $window, $location) { | |
| var track = function() { | |
| $window._gaq.push(['_trackPageview', $location.path()]); | |
| }; | |
| $rootScope.$on('$viewContentLoaded', track); | |
| } | |
| ]); |