(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.
$(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 { |
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
// | |
// 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 |
// 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]; |
// 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 { |
(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.
// 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": [ |
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); | |
}]; |
// | |
// CollectionViewDataSource.swift | |
// Khan Academy | |
// | |
// Created by Andy Matuschak on 10/14/14. | |
// Copyright (c) 2014 Khan Academy. All rights reserved. | |
// | |
import UIKit |
var mediaJSON = { "categories" : [ { "name" : "Movies", | |
"videos" : [ | |
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ], | |
"subtitle" : "By Blender Foundation", | |
"thumb" : "images/BigBuckBunny.jpg", | |
"title" : "Big Buck Bunny" | |
}, | |
{ "description" : "The first Blender Open Movie from 2006", | |
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ], |