Upgrade to Pro — share decks privately, control downloads, hide ads and more …

BubbleWrap

 BubbleWrap

Slides for my talk at #inspect 2013 - the first RubyMotion conference in Bruselles.

Marin Usalj

March 29, 2013
Tweet

More Decks by Marin Usalj

Other Decks in Programming

Transcript

  1. [@3 times:^{ NSLog(@"Hello!"); }]; // Hello! // Hello! // Hello!

    NSDate *future = @(24).days.fromNow; // 2012-12-25 20:49:05 +0000 NSDate *past = @(1).month.ago; // 2012-11-01 20:50:28 +00:00 NSString *sentence = NSStringWithFormat(@"This is a text-with- argument %@", @1234); [sentence split:@"-"] // array = this is a text, with, argument 1234 ObjectiveSugar github.com/mneorr/ObjectiveSugar Tuesday, April 2, 13
  2. [cars each:^(id object) { NSLog(@"Car: %@", object); }]; // Car:

    Testarossa // Car: F50 // Car: F458 Italia [cars map:^id(id car){ return @([[car substringToIndex:1] isEqualToString:@"F"]); }]; // NO (Testarossa) // YES (F50) // YES (F458 Italia) ObjectiveSugar github.com/mneorr/ObjectiveSugar Tuesday, April 2, 13
  3. // creating [Person create:@{ @"name" : @"John", @"age" : @12

    }]; Person *john = [Person create]; john.name = @"John"; // save/delete [john save]; [john delete]; // querying Person *johnDoe = [Person where:@"name == 'John' AND surname = 'Doe'"].first; NSArray *people = [Person where:@{ @"age" : @18 }]; ObjectiveRecord github.com/mneorr/ObjectiveRecord Tuesday, April 2, 13
  4. AFJSONRequestOperation.JSONOperationWithReuqest( NSURLRequest.requestWithURL( NSURL.URLWithString(‘http://mneorr.com’)), success: lambda{ |request, response, json| # handle

    good response } failure: lambda{ |request, response, error, json| # handle bad response }).start Tuesday, April 2, 13
  5. params = { foo: ‘bar’, baz: [:bang, :zsh] } HTTP.post(‘http://mneorr.com’,

    payload: params) do |response| if response.ok? # handle good response else # handle failure end end Tuesday, April 2, 13
  6. > Device.iphone? # true > Device.ipad? # false > Device.front_camera?

    # true > Device.orientation # :portrait > Device.simulator? # true > Device.ios_version # "6.0" Tuesday, April 2, 13
  7. JSON.parse("{\"foo\":1,\"bar\": [1,2,3],\"baz\":\"awesome\"}") => { foo: 1, bar: [1,2,3], baz: “awesome”

    } JSON.generate({ foo: 1, bar: [1,2,3], baz: “awesome” }) => "{\"foo\":1,\"bar\":[1,2,3],\"baz\": \"awesome\"}" Tuesday, April 2, 13
  8. [Client]: hey, how hard is it to store some user

    data? We may need to keep track of Foo and Bar! Tuesday, April 2, 13
  9. “There is a ton of great stuff in BubbleWrap.” “If

    you’re doing any RubyMotion work, I think you should definitely checkout BubbleWrap!” - the changelog Tuesday, April 2, 13
  10. “To make our networking code painless, we’ll use BubbleWrap” -

    smashingmagazine.com “Lots of good stuff in BubbleWrap” - Darrin Holst Tuesday, April 2, 13
  11. “If there’s any one thing you can do after starting

    a RubyMotion project, it’s immediately drop BubbleWrap into your repo.” - Nick, 37 Signals Tuesday, April 2, 13