Skip to content

Instantly share code, notes, and snippets.

@paulmiard
paulmiard / 0_reuse_code.js
Created May 8, 2014 20:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@paulmiard
paulmiard / Magic.m
Last active August 29, 2015 13:56
Example for getting "Link" HTTP header using AFNetworking
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@"https://api.github.com/search/code?q=addClass+user:mozilla&page=4&per_page=42" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
//NSLog(@"JSON: %@", responseObject);
NSDictionary *headers = operation.response.allHeaderFields;
//NSLog(@"Headers: %@", [headers description]);
NSLog(@"Link: %@", [headers objectForKey:@"Link"]);
//Will look like Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=5&per_page=42>; rel="next", <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=24&per_page=42>; rel="last", <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=1&per_page=42>; rel="first", <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=3&per_page=42>; rel="prev"