This gist is no longer valid. Please see Compass-Rails for instructions on how to install.
This file contains 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
// | |
// Backbone.Rails.js | |
// | |
// Makes Backbone.js play nicely with the default Rails setup, i.e., | |
// no need to set | |
// ActiveRecord::Base.include_root_in_json = false | |
// and build all of your models directly from `params` rather than | |
// `params[:model]`. | |
// | |
// Load this file after backbone.js and before your application JS. |
This file contains 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
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript | |
powered JS and SASS powered CSS with YUI compression all via the magic of rack. | |
This stuff will be native in Rails 3.1 and the layout of the files on the | |
filesystem will be different but this guide will get you working with it | |
while we wait for all that to finalize. | |
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist. | |
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention |
This file contains 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
// REQUIRES JQUERY AND BACKBONE TO BE LOADED FIRST | |
// | |
// With additions by Maciej Adwent http://github.com/Maciek416 | |
// If token name and value are not supplied, this code Requires jQuery | |
// | |
// Adapted from: | |
// http://www.ngauthier.com/2011/02/backbone-and-rails-forgery-protection.html | |
// Nick Gauthier @ngauthier | |
// |
This file contains 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
jasmine.Fixtures.prototype.loadTemplate_ = function(template) { | |
var templateUrl = "/backbone/templates/" + template; | |
var self = this; | |
$.ajax({ | |
async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded | |
cache: false, | |
dataType: 'html', | |
url: templateUrl, | |
success: function(data) { | |
$('#' + self.containerId).append(data); |
This file contains 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
// Backbone.js 0.5.3 | |
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc. | |
// Backbone may be freely distributed under the MIT license. | |
// For all details and documentation: | |
// http://documentcloud.github.com/backbone | |
(function(){ | |
// Initial Setup | |
// ------------- |
This file contains 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
moment.tz.add({ | |
"zones": { | |
"Africa/Algiers": [ | |
"0:12:12 - LMT 1891_2_15_0_1 0:12:12", | |
"0:9:21 - PMT 1911_2_11 0:9:21", | |
"0 Algeria WE%sT 1940_1_25_2", | |
"1 Algeria CE%sT 1946_9_7 1", | |
"0 - WET 1956_0_29", | |
"1 - CET 1963_3_14 1", | |
"0 Algeria WE%sT 1977_9_21 1", |
These rules are adopted from the AngularJS commit conventions.
This file contains 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
// for an updated version see https://github.com/jsdf/react-native-refreshable-listview | |
var React = require('react-native') | |
var { | |
ListView, | |
ActivityIndicatorIOS, | |
StyleSheet, | |
View, | |
Text, | |
} = React |
First couple things I thought about when migrating after reading the docs
So migrating my existing app wasn't as troublesome as I originally thought. First thing I did was take a look at my router and routes
and figure try to make a mental model of all the files where I had nested routes in the existing app because those components/containers will contain {this.props.children}
. So I need to replace those with the nested <Match />
components.
So just to give an example:
<Router history={history}>
<Route path="/" component={App}>
OlderNewer