Skip to content

Instantly share code, notes, and snippets.

View shepting's full-sized avatar

Steven Hepting shepting

View GitHub Profile

Keybase proof

I hereby claim:

  • I am shepting on github.
  • I am stevenhepting (https://keybase.io/stevenhepting) on keybase.
  • I have a public key whose fingerprint is 8148 34C8 3A9B E695 9FB2 D301 5FED 5668 FAF9 8F49

To claim this, I am signing this object:

@shepting
shepting / upload.m
Created January 28, 2015 23:50
Upload an image using Twitter Fabric
[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error){
// Ensure the auth worked
if (session) {
NSLog(@"Twitter Session %@ / %@ found", session.authToken, session.authTokenSecret);
} else {
NSLog(@"Login error: %@", error);
}
// Get a random image
UIImage *corgiImage = [UIImage imageNamed:@"Corgis_Small.jpeg"];
@shepting
shepting / NetworkEnabler.swift
Last active June 8, 2018 17:03
Xcode Playgrounds will fail network requests when Charles is running since ATS will fail. With an Xcode project you can update the Info.plist but Playgrounds don't have any such option. This is that option.
// When using Charles, the network requests will always fail unless you can bypass ATS.
public class NetworkEnabler: NSObject, NSURLSessionDelegate {
public func URLSession(session: NSURLSession, didReceiveChallenge challenge: NSURLAuthenticationChallenge, completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void) {
completionHandler(.UseCredential, NSURLCredential(trust: challenge.protectionSpace.serverTrust!))
}
}
// Then later when making a request:
let enabler = NetworkEnabler()
let session = NSURLSession(configuration: NSURLSession.sharedSession().configuration, delegate: enabler, delegateQueue: nil)
@shepting
shepting / NodeTraversal.swift
Last active November 24, 2015 22:55
Print out a tree of nodes with multiple children each.
//
// main.swift
// NodeTraversal
//
// Created by Steven Hepting on 11/16/15.
// Copyright © 2015 Steven Hepting. All rights reserved.
// Algorithm from http://bit.ly/1kSdSvc
//
import Foundation
@shepting
shepting / SimpleChildTimelineViewController.m
Created January 26, 2016 02:11
Some users have requested a sample implementation to make a child viewcontroller showing a timeline of Tweets.
#import <TwitterKit/TwitterKit.h>
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor lightGrayColor];
// Standard TWTRTimelineViewController setup
@shepting
shepting / dynamic_libraries.log
Created July 2, 2016 23:16
Simulator Dynamic Libraries
2016-07-02 14:37:59.661 LinkAndLoad[15250:19961985] Libraries loaded: 124
2016-07-02 14:37:59.662 LinkAndLoad[15250:19961985] Image count: 0.52ms
2016-07-02 14:37:59.662 LinkAndLoad[15250:19961985] Read last file: 0.40ms
2016-07-02 14:37:59.665 LinkAndLoad[15250:19961985] Launch launch library details:
Opened stream at: 2016-07-02 21:37:41 +0000
Added: 0x109c86000 164126720 /Users/shepting/Library/Developer/CoreSimulator/Devices/25098D4E-25AE-4957-9A36-C0541D1DC426/data/Containers/Bundle/Application/0BE633E7-D9E5-45A1-9F87-FF804CB3F87E/LinkAndLoad.app/LinkAndLoad
Added: 0x109d00000 4459593728 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/libBacktraceRecording.dylib
Added: 0x109d0e000 4459651072 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
Added: 0x109d1a000 4459700224 /Applicati
@shepting
shepting / SwiftTypes.swift
Created September 23, 2016 14:26
LLDB Type Lookup Swift
import SwiftShims
struct UnsafePointer<Pointee> : Strideable, Hashable, _Pointer {
typealias Distance = Swift.Int
let _rawValue: Builtin.RawPointer
init(_ _rawValue: Builtin.RawPointer)
init(_ from: Swift.OpaquePointer)
init?(_ from: Swift.OpaquePointer?)
init?(bitPattern: Swift.Int)
init?(bitPattern: Swift.UInt)
init(_ other: Swift.UnsafePointer<Pointee>)

Keybase proof

I hereby claim:

  • I am shepting on github.
  • I am stevenhepting (https://keybase.io/stevenhepting) on keybase.
  • I have a public key whose fingerprint is 009A 0C95 8411 C796 443F 2F35 5FDD 6DA6 B9C9 1940

To claim this, I am signing this object:

@shepting
shepting / NetworkJSON.swift
Last active June 26, 2017 17:18
Simple Swift Network Parsing
//
// Networking.swift
// DemoPersonViewer
//
// Created by Steven Hepting on 6/23/17.
// Copyright © 2017 Hepting. All rights reserved.
//
import Foundation
@shepting
shepting / JSONParsing.swift
Created June 26, 2017 18:45
Swift Networking for RandomUser.API
//
// JSONParsing.swift
// DemoPersonViewer
//
// Created by Steven Hepting on 6/26/17.
// Copyright © 2017 Hepting. All rights reserved.
//
import Foundation