(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// | |
// CollectionViewDataSource.swift | |
// Khan Academy | |
// | |
// Created by Andy Matuschak on 10/14/14. | |
// Copyright (c) 2014 Khan Academy. All rights reserved. | |
// | |
import UIKit |
NSString *url = @"http://api.rottentomatoes.com/api/public/v1.0/lists/movies/in_theaters.json?apikey=ws32mxpd653h5c8zqfvksxw9"; | |
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; | |
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { | |
id object = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; | |
self.movies = object[@"movies"]; | |
[self.tableView reloadData]; | |
NSLog(@"%@", object); | |
}]; |
// This code accompanies a blog post: http://chris.eidhof.nl/posts/json-parsing-in-swift.html | |
// | |
// As of Beta5, the >>= operator is already defined, so I changed it to >>>= | |
import Foundation | |
let parsedJSON : [String:AnyObject] = [ | |
"stat": "ok", | |
"blogs": [ |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// Save this as MineSweeper.java | |
// compile with this command | |
// javac MineSweeper.java | |
// then run with this command | |
// java MineSweeper | |
// We need this for random numbers. | |
import java.util.Random; | |
class MineSweeper { |
// URL of the endpoint we're going to contact. | |
NSURL *url = [NSURL URLWithString:@"http://localhost:8080/my.json"]; | |
// Create a simple dictionary with numbers. | |
NSDictionary *dictionary = @{ @"numbers" : @[@1, @2, @3] }; | |
// Convert the dictionary into JSON data. | |
NSData *JSONData = [NSJSONSerialization dataWithJSONObject:dictionary | |
options:0 | |
error:nil]; |
// | |
// JEProgressView.h | |
// | |
// | |
// Created by John Rommel Estropia on 2014/03/11. | |
// Copyright (c) 2014 John Rommel Estropia. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights |
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
$(document).ready(function() { | |
var embedGist = function () { | |
$('a[href^="https://gist.github.com"]').each(function(i) { | |
if (writeCapture) { | |
var wrapper = $("<div></div>"); | |
wrapper.insertAfter(this); | |
writeCapture.html(wrapper[0], '<script src="'+$(this).attr("href")+'.js"></script>'); | |
$(this).remove(); | |
} else { |
#import <Specta.h> | |
#define EXP_SHORTHAND | |
#import <Expecta.h> | |
#import <CoreData/CoreData.h> | |
SpecBegin(CoreDataInMemorySetupExample) | |
__block NSManagedObjectContext *context; | |
beforeAll(^{ | |
// ObjectModel from any models in app bundle |