Skip to content

Instantly share code, notes, and snippets.

View andrewhavens's full-sized avatar

Andrew Havens andrewhavens

View GitHub Profile
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|
class AppDelegate < PM::Delegate
def on_load(app, options)
open ListEventsScreen.new(nav_bar: true)
end
end
app.info_plist['NSAppTransportSecurity'] = {'NSAllowsArbitraryLoads' => true}
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
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"
$ potion g table_screen list_events
$ cd calagator
$ bundle exec rake
$ potion new calagator
Creating app...
Running bundle...
Installing CocoaPods...
Installation complete!
$ gem install redpotion
Successfully installed redpotion-1.5.0
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