Skip to content

Instantly share code, notes, and snippets.

@pt-arvind
pt-arvind / gist:6041458
Created July 19, 2013 18:50
public key pinning
- (void)connection:(NSURLConnection *)connection
willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
BOOL shouldPerformConnectionSecurityMeasures = [[MINetworkSecurityManager sharedManager] shouldPerformConnectionSecurityMeasuresForURLConnection:connection];
BOOL trusted = shouldPerformConnectionSecurityMeasures ? [[MINetworkSecurityManager sharedManager] evaluateServerTrust:serverTrust] : [[MINetworkSecurityManager sharedManager] evaluateTrust:serverTrust forSecurityModel:MINetworkSecurityModelStandard error:nil];
[merge]
tool = p4mergetool
[mergetool "p4mergetool"]
cmd = "'/Applications/p4merge.app/Contents/Resources/launchp4merge'" "\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\""
trustExitCode = false
[mergetool]
keepBackup = false
[diff]
tool = p4mergetool
[difftool "p4mergetool"]
@pt-arvind
pt-arvind / Fetchable.swift
Created November 17, 2015 23:09 — forked from capttaco/Fetchable.swift
A utility protocol for custom NSManagedObjects that makes querying contexts simpler and more convenient. Requires Swift 2.
import CoreData
protocol Fetchable
{
typealias FetchableType: NSManagedObject
static func entityName() -> String
static func objectsInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> [FetchableType]
static func singleObjectInContext(context: NSManagedObjectContext, predicate: NSPredicate?, sortedBy: String?, ascending: Bool) throws -> FetchableType?
static func objectCountInContext(context: NSManagedObjectContext, predicate: NSPredicate?) -> Int
@pt-arvind
pt-arvind / index.js
Created May 7, 2024 14:21 — forked from smithclay/index.js
"Hello World" AWS Lambda + Terraform Example
// 'Hello World' nodejs6.10 runtime AWS Lambda function
exports.handler = (event, context, callback) => {
console.log('Hello, logs!');
callback(null, 'great success');
}