In Ember, the application's state manager handles routing. Let's take a look at a simple example:
App.stateManager = Ember.StateManager.create({
start: Ember.State.extend({
index: Ember.State.extend({
route: "/",| after "deploy:restart", "resque:stop_workers" | |
| namespace :resque do | |
| task :stop_workers, :except => { :no_release => true } do | |
| run "cd #{current_path} && rake RAILS_ENV=#{rails_env} resque:stop_workers" | |
| end | |
| end |
| # If your workers are inactive for a long period of time, they'll lose | |
| # their MySQL connection. | |
| # | |
| # This hack ensures we re-connect whenever a connection is | |
| # lost. Because, really. why not? | |
| # | |
| # Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar) | |
| # | |
| # From: | |
| # http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/ |
| class String | |
| def to_bool | |
| return true if self == true || self =~ (/(true|t|yes|y|1)$/i) | |
| return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) | |
| raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") | |
| end | |
| end |
Start XCode and create a new Storyboard file. I closed all my other XCode projects. When you choose the location of the created file, it should be your RubyMotion project's resources directory. Add a UIViewController, and set it's identifier property to "Start". Add some UI elements so you can see it working.
When you run rake in your RubyMotion project, it will compile the .storyboard file. You could auto-load the Storyboard using a plist configuration, but you'll see code can do it too.
| watch /src\/.*\.haml/ do |md| `thor convert:haml` end | |
| watch /src\/.*\.rb/ do |md| `thor convert:haml` end | |
| watch /src\/.*\.scss/ do |md| `thor convert:sass` end | |
| watch /src\/.*\.sass/ do |md| `thor convert:sass` end | |
| watch /src\/.*\.coffee/ do |md| `thor convert:coffee` end |
| // ---------------------------------------------------------- | |
| // A short snippet for detecting versions of IE in JavaScript | |
| // without resorting to user-agent sniffing | |
| // ---------------------------------------------------------- | |
| // If you're not in IE (or IE version is less than 5) then: | |
| // ie === undefined | |
| // If you're in IE (>=5) then you can determine which version: | |
| // ie === 7; // IE7 | |
| // Thus, to detect IE: | |
| // if (ie) {} |
| // ---------------------------------------------------------- | |
| // A short snippet for detecting versions of IE in JavaScript | |
| // without resorting to user-agent sniffing | |
| // ---------------------------------------------------------- | |
| // If you're not in IE (or IE version is less than 5) then: | |
| // ie === undefined | |
| // If you're in IE (>=5) then you can determine which version: | |
| // ie === 7; // IE7 | |
| // Thus, to detect IE: | |
| // if (ie) {} |
| Drop in replace functions for setTimeout() & setInterval() that | |
| make use of requestAnimationFrame() for performance where available | |
| http://www.joelambert.co.uk | |
| Copyright 2011, Joe Lambert. | |
| Free to use under the MIT license. | |
| http://www.opensource.org/licenses/mit-license.php |
| /** | |
| * Slanted tabs with CSS 3D transforms | |
| * See http://lea.verou.me/2013/10/slanted-tabs-with-css-3d-transforms/ | |
| */ | |
| body { padding: 50px; } | |
| nav { | |
| position: relative; | |
| z-index: 1; |