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
| /** | |
| * @jsx React.DOM | |
| */ | |
| var App.Views.MyComponent = React.createClass({ | |
| render: function() { | |
| return ( | |
| <p>Awesome Code</p> | |
| ); |
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
| /** | |
| * @jsx React.DOM | |
| */ | |
| var CommentModel = Backbone.Model.extend({ | |
| defaults: { | |
| author: '', | |
| text: '', | |
| image: '' | |
| } |
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 ModelMixin = { | |
| __syncedModels: [], | |
| componentDidMount: function() { | |
| // Whenever there may be a change in the Backbone data, trigger a reconcile. | |
| this.getBackboneModels().forEach(this.injectModel, this); | |
| }, | |
| componentWillUnmount: function() { | |
| // Ensure that we clean up any dangling references when the component is | |
| // destroyed. | |
| this.__syncedModels.forEach(function(model) { |
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
| loadResultSnippits: function(results){ | |
| var documents = []; | |
| for(var i = 0; i < results.length; i++){ | |
| var url = $(results[i]).attr('url'), | |
| title = $(results[i]).find('content[name="title"]').text(), | |
| fileType = $(results[i]).find('content[name="filetype"]').text(), | |
| language = $(results[i]).find('content[name="language"]').text(), | |
| date = $(results[i]).find('content[name="last-modified"]').text().substring(0, 14), | |
| snippet = $(results[i]).find('content[name="snippet"]').text(); |
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 Feature = (function(){ | |
| var Feature = function(){ | |
| this.init(); | |
| }; | |
| _.extend(Feature.prototype, { | |
| init: function() { | |
| console.log("Feature!"); | |
| } |
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
| @mixin transparent($color, $alpha) { | |
| $rgba: rgba($color, $alpha); | |
| $ie-hex-str: ie-hex-str($rgba); | |
| background-color: transparent; | |
| background-color: $rgba; | |
| filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#{$ie-hex-str},endColorstr=#{$ie-hex-str}); | |
| zoom: 1; | |
| } |
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
| App.Helpers.checkWidth = (function(conds) { | |
| conds.init = function() { | |
| $.subscribe('resize', function(){ | |
| console.log('resize event fired'); | |
| App.Helpers.getWidth(); | |
| // if mobile width, mobile media query or mobile ua returns true, broadcast a resize:mobile event | |
| if ( App.Devices.mobile || App.Devices.mobileMQ || App.Devices.mobileCheck ) $.publish('resize:mobile'); |
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 Width Helper - This is re-run on every debouced resize event that will help setup our responsiveness | |
| */ | |
| App.Helpers.getWidth = function() { | |
| // Lets setup our widths | |
| App.Helpers.innerWidth = !window.innerWidth ? document.documentElement.clientWidth : window.innerWidth; | |
| // Queries based on screen width | |
| App.Devices.desktop = App.Helpers.innerWidth > App.Constants.DESKTOP, |
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
| App.Features.sampleFeature = (function(sample) { | |
| function Feature(element) { | |
| this.$el = element; | |
| }; | |
| Feature.Constants = { | |
| }; | |
| _.extend(Feature.prototype, App.Class, { |
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
| App.Helpers.resizeThrottle = (function(throttle) { | |
| throttle.init = function() { | |
| var updateLayout = _.debounce(function(e) { | |
| console.log('Throttled resize event. Broadcasting...'); | |
| $.publish('resize'); | |
| }, 500); | |
| if (window.addEventListener) { | |
| window.addEventListener("resize", updateLayout, false); | |
| } | |
| }; |