Skip to content

Instantly share code, notes, and snippets.

View dornad's full-sized avatar

Daniel Rodriguez dornad

View GitHub Profile
@dornad
dornad / DRAppStoreManager.h
Created December 6, 2013 00:34
DRAppStoreManager A singleton manager for InApp Purchases on iOS.
//
//
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
@protocol DRAppStoreManagerDelegate;
#define DRAppStoreCallback(callback, object) if (callback) callback(object);
@dornad
dornad / gist:f2a8ba4b3ddab35114cc
Last active October 2, 2017 12:24
NSError** mocking with OCMock 3
- (void)testMethodExpectingNoError
{
id someObject = [self someMethodThatReturnsAnExpectedObject];
id mockDependencuy = OCMClassMock([DependencyToBeMocked class]);
OCMStub([mockDependency someMethodWithErrorRef:[OCMArg anyObjectRef]).andReturn(someObject);
NSError * error = nil;
id someReturnedValue =[self.objectUnderTest someMethodWithErrorRef:&error]:
XCTAssertNotNil(someReturnedValue);
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from subprocess import Popen, PIPE
from subprocess import call
p = Popen(["xcrun","simctl","list","devices"], stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = p.communicate(b"input data that is passed to subprocess' stdin")
@objc public enum Features: Int {
case ScheduledSendingCoachmark = 0
case AccountVerifyFailureToggle
}
extension Features {
private var userDefaultsKey: String {
switch(self) {
@dornad
dornad / PlacesConversion.swift
Created July 20, 2016 15:12
Places Conversion Playground Code
//: Playground - noun: a place where people can play
import UIKit
public class Variable<T> {
var value: T
init(_ value: T) {
self.value = value
}
}
@dornad
dornad / CoreData Playground Patch
Created October 21, 2016 03:06
Core Data Playground (WIP)
diff --git a/Playgrounds/PricingAPIModels.playground/Contents.swift b/Playgrounds/PricingAPIModels.playground/Contents.swift
index f0c121a..2ada632 100644
--- a/Playgrounds/PricingAPIModels.playground/Contents.swift
+++ b/Playgrounds/PricingAPIModels.playground/Contents.swift
@@ -1,42 +1,50 @@
//: Playground - noun: a place where people can play
import UIKit
+import CoreData
import PPNetworking
This file has been truncated, but you can view the full file.
Showing All Messages
Build target EventDetails of project EventDetails with configuration Debug
Write auxiliary files
write-file /Users/danielrodriguez/Library/Developer/Xcode/DerivedData/EventDetails-eqemjjsflerddceiqpqrjovmtdbi/Build/Intermediates/EventDetails.build/Debug-iphonesimulator/EventDetails.build/unextended-module-overlay.yaml
/bin/mkdir -p /Users/danielrodriguez/Library/Developer/Xcode/DerivedData/EventDetails-eqemjjsflerddceiqpqrjovmtdbi/Build/Intermediates/EventDetails.build/Debug-iphonesimulator/EventDetails.build/DerivedSources
write-file /Users/danielrodriguez/Library/Developer/Xcode/DerivedData/EventDetails-eqemjjsflerddceiqpqrjovmtdbi/Build/Intermediates/EventDetails.build/Debug-iphonesimulator/EventDetails.build/DerivedSources/EventDetails_vers.c
@dornad
dornad / FindFontName.swift
Last active February 7, 2017 21:28
iOS Find Font Name [Swift 3]
///////////////////////////////////////////////////////
//prints out available fonts.
// Adopted from http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/#uifont
//WARNING!!! YOU MUST FOLLOW ALL THE STEPS TO GET THE FONT TO WORK.
//1. Include the font in the project
//2. Make sure that they’re included in the target
// Check build phases and check the target membership(s))
//3. Double check that your fonts are included as Resources in your bundle. check copy resources in build phases section. make sure font is selected
@dornad
dornad / FindFontName.m
Last active February 8, 2017 16:54
iOS Find Font Names [Objective-C]
///////////////////////////////////////////////////////
//prints out available fonts.
// from http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/#uifont
//WARNING!!! YOU MUST FOLLOW ALL THE STEPS TO GET THE FONT TO WORK.
//1. Include the font in the project
//2. Make sure that they’re included in the target
// Check build phases and check the target membership(s))
//3. Double check that your fonts are included as Resources in your bundle. check copy resources in build phases section. make sure font is selected
class MovieTableViewController : UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(MovieCell.self, forCellReuseIdentifier: "MovieCell")
}
}
extension MovieTableViewController {