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
| // In your actual app's JS, do not initialize if site is iframed. | |
| require(['app-global'], function(AppGlobal) { | |
| if ( top !== self ) { | |
| return; | |
| } | |
| // Otherwise |
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
| // Tests : Example | |
| var i, // testing iframe. | |
| w; // testing iframe's window object. | |
| module("Backbone Routers", { | |
| setup: function() { | |
| // Async, hold tests until iframe loads. |
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
| // Create an <iframe>, return the DOM object | |
| // back to the caller once loaded. | |
| var iframeLoad = function(pageURL, cb){ | |
| var iframe = document.createElement('iframe'); | |
| iframe.onload = function(event) { | |
| // Return iframe to callback. |
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
| # Colors | |
| BLACK="\[\e[0;30m\]" | |
| BLUE="\[\e[1;34m\]" | |
| GREEN="\[\e[0;32m\]" | |
| LIME="\[\e[1;32m\]" | |
| CYAN="\[\e[0;36m\]" | |
| ORANGE="\[\e[1;31m\]" | |
| RED="\[\e[0;31m\]" | |
| PURPLE="\[\e[0;35m\]" | |
| BROWN="\[\e[0;33m\]" |
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
| <script type="text/template" id="template_loader"> | |
| <div class="loader <%= className %>"> | |
| <% for ( var i = 0; i <= 11; i++ ) { %> | |
| <div class="bar<%= i %>"></div> | |
| <% } %> | |
| </div> | |
| </script> |
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 CupView = Backbone.View.extend({ | |
| 'events': {}, | |
| 'settings': { | |
| 'shardCount': 10, | |
| 'columnWidth': 300, | |
| 'columnHeight': 500 | |
| }, |
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
| $icons: sprite-map("icons/*.png"); | |
| $icons-background: sprite-url($icons) no-repeat transparent; | |
| @mixin icons-image-replacement($sprite) { | |
| background: $icons-background; | |
| background-position: sprite-position($icons, $sprite); | |
| border: 0; | |
| color: transparent; | |
| display: block; |
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
| #foo { display: block; float: left; | |
| -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=40)"; | |
| filter:alpha(opacity=40); | |
| opacity: 0.4; | |
| } |
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 support for outerHTML, which in FF was only added at version 11. | |
| // Only use elem.outerHTML once support for FF<11 is no longer needed. | |
| (function($){ | |
| $.fn.outerHTML = function() { | |
| var a = this.get(0).outerHTML; | |
| return a ? a : $('<p/>').append(this.clone()).html(); | |
| } | |
| })(jQuery); |
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 x = [1,3,'b',5,2,4,'a']; | |
| x.sort(function(a,b){ | |
| if ( typeof a === typeof b ) { | |
| return (a > b); | |
| } else { | |
| return typeof a > typeof b; | |
| } | |
| }); |