Skip to content

Instantly share code, notes, and snippets.

Andrew Havens andrewhavens

View GitHub Profile
View list_events_screen.rb
class ListEventsScreen < PM::TableScreen
title "Upcoming Events"
def on_load
@events = []
load_events
end
def load_events
AFMotion::JSON.get("http://calagator.org/events.json") do |response|
View app_delegate.rb
class AppDelegate < PM::Delegate
def on_load(app, options)
open ListEventsScreen.new(nav_bar: true)
end
end
View Rakefile
app.info_plist['NSAppTransportSecurity'] = {'NSAllowsArbitraryLoads' => true}
View afmotion_example.rb
AFMotion::JSON.get("http://calagator.org/events.json") do |response|
if response.success?
# do something with the response.object
else
# display an error message to the user
end
end
View example_table_screen.rb
class ExampleTableScreen < PM::TableScreen
title "The title of our screen in the nav bar"
def on_load
# do some setup here
end
def table_data
[{
title: "Section title goes here"
View potion-new.sh
$ potion new calagator
Creating app...
Running bundle...
Installing CocoaPods...
Installation complete!
View install-redpotion.sh
$ gem install redpotion
Successfully installed redpotion-1.5.0
View app_delegate.rb
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
rootViewController = UIViewController.alloc.init
rootViewController.title = 'my_first_rm_app'
rootViewController.view.backgroundColor = UIColor.whiteColor
navigationController = UINavigationController.alloc.initWithRootViewController(rootViewController)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.rootViewController = navigationController
You can’t perform that action at this time.