You need the package manager Homebrew (if not installed), see http://brew.sh/
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Get Spark 'Source Code':
http://spark.apache.org/downloads.html
class City: NSObject, NSCoding | |
{ | |
var name: String? | |
var id: Int? | |
required init?(coder aDecoder: NSCoder) | |
{ | |
self.name = aDecoder.decodeObject(forKey: "name") as? String | |
self.id = aDecoder.decodeObject(forKey: "id") as? Int | |
} |
public struct Event { | |
public internal(set) var timeStamp: Date | |
public internal(set) var eventTag: String | |
public init(timeStamp: Date, tag: String) { | |
self.timeStamp = timeStamp | |
self.eventTag = tag | |
} | |
} |
// To check if a number is between a range, don't do | |
if number >=0 && number <= 100 { | |
} | |
// Use range and news operators instead : | |
if 0...100 ~= number { | |
} |
You need the package manager Homebrew (if not installed), see http://brew.sh/
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Get Spark 'Source Code':
http://spark.apache.org/downloads.html
{ | |
"title": "Swift models as structs or classes?", | |
"timestamp": "2015-07-17T20:18:46.000Z", | |
"visbility": "public", | |
"visibility": "public" | |
} |
/* | |
Overview | |
-------- | |
To run a query using anorm you need to do three things: | |
1. Connect to the database (with or without a transaction) | |
2. Create an instance of `anorm.SqlQuery` using the `SQL` string interpolator | |
3. Call one of the methods on `SqlQuery` to actually run the query |
public static String reverseRecursively(String str) { | |
//base case to handle one char string and empty string | |
if (str.length() < 2) { | |
return str; | |
} | |
return reverseRecursively(str.substring(1)) + str.charAt(0); | |
} |
- (void) fetchThingsWithCompletion:(void (^)(NSArray *, NSError *))completion{ | |
[context performBlock:^{ | |
result = [context executeFetch:... | |
if (completion != nil){ | |
completion(result, error); | |
} | |
}]; | |
} |
// These two need to be declared outside the try/catch | |
// so that they can be closed in the finally block. | |
HttpURLConnection urlConnection = null; | |
BufferedReader reader = null; | |
// Will contain the raw JSON response as a string. | |
String forecastJsonStr = null; | |
try { | |
// Construct the URL for the OpenWeatherMap query |
<?php | |
// include required files form Facebook SDK | |
require_once( 'Facebook/HttpClients/FacebookHttpable.php' ); | |
require_once( 'Facebook/HttpClients/FacebookCurl.php' ); | |
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' ); | |
require_once( 'Facebook/Entities/AccessToken.php' ); | |
require_once( 'Facebook/Entities/SignedRequest.php' ); |