This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary* headers = @{@"accept": @"application/json"}; | |
NSDictionary* parameters = @{@"parameter": @"value", @"foo": @"bar"}; | |
[[UNIRest post:^(UNISimpleRequest* request) { | |
[request setUrl:@"http://httpbin.org/post"]; | |
[request setHeaders:headers]; | |
[request setParameters:parameters]; | |
}] asJsonAsync:^(UNIHTTPJsonResponse* response, NSError *error) { | |
// This is the asyncronous callback block | |
NSInteger* code = [response code]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://technet.rapaport.com/info/RapLink/ | |
//1 - Authenticate with TechNet. The authentication ticket will be stored in $auth_ticket. Note this MUST be HTTPS. | |
$auth_url = "https://technet.rapaport.com/HTTP/Authenticate.aspx"; | |
$post_string = "username=YOURUSERNAME&password=" . urlencode("YOURPASSWORD"); | |
//create HTTP POST request with curl: | |
$request = curl_init($auth_url); // initiate curl object | |
curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response | |
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RMSerialization.m | |
#import "RMContext.h" | |
@implementation RMContext | |
+ (NSString*) serializationPath | |
{ | |
NSFileManager* fileManager = [[NSFileManager alloc] init]; | |
NSString* bundleID = [[NSBundle mainBundle] bundleIdentifier]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { | |
//Code | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SystemConfiguration | |
public class Reachability { | |
class func isConnectedToNetwork() -> Bool { | |
var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0)) | |
zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress)) | |
zeroAddress.sin_family = sa_family_t(AF_INET) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Node { | |
public $info; | |
public $left; | |
public $right; | |
public $level; | |
public function __construct($info) { | |
$this->info = $info; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pin for a specific Board: | |
https://api.pinterest.com/v3/pidgets/boards/{user_id}/{board}/pins/ | |
Pin for a specific User: | |
http://api.pinterest.com/v3/pidgets/users/{user_id}/pins/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copy and paste the above script into a text file (I’ve named mine force-ntp-update). | |
On the command line, call chmod a+x /path/to/force-ntp-update to allow all users to execute the command. | |
If you’re the only user who should be able to execute the command, change the above to chmod u+x /path/to/force-ntp-update. | |
Move the script somewhere in your path: mv /path/to/force-ntp-update /usr/local/bin. | |
``` | |
#!/bin/bash | |
# Forces an ntp update | |
# Fail fast (set -e will bail at first error) |