Skip to content

Instantly share code, notes, and snippets.

View lemonkey's full-sized avatar
🏠
Working from home

Ari Braginsky lemonkey

🏠
Working from home
View GitHub Profile
@lemonkey
lemonkey / gist:5208512
Last active December 15, 2015 05:19
Cron job script to automatically notify you via email and telephone (using Twilio) if Apple's WWDC website changes. Originally written for Bash environments that have Sendmail installed.
#!/bin/sh
CAN_COMPARE=0;
EMAIL="<list of email addresses separated with a space";
# If index.html exists, rename to index.html.old.
if [ -f index.html ];
then
CAN_COMPARE=1;
mv index.html index.html.old

Keybase proof

I hereby claim:

  • I am lemonkey on github.
  • I am lemonkey (https://keybase.io/lemonkey) on keybase.
  • I have a public key whose fingerprint is 864D B213 DBD6 A2C5 943E 1EDD A604 2AA8 08C1 7367

To claim this, I am signing this object:

@lemonkey
lemonkey / gist:22ba6a95b1751c1583cc
Created August 7, 2014 02:57
nsmeetup-20140806
NSMeetup: Designing Your API Client (@sandofsky)
2014/08/06
500px client example
(in swift)
twitter iOS model layer used in mac client
@lemonkey
lemonkey / update_xcconfig_build_version.rb
Last active September 18, 2015 01:45
Increment BUILD_VERSION property in an xcconfig file (useful when you have multiple targets that all need to have the same build version, such as with a watchOS 2 app and your continuous deployment system needs to increment the build version)
# Assumes build version in xcconfig is defined as the following, where no spaces, spaces and/or tabs are allowed:
# BUILD_VERSION = 1.2.3.4
filename = "sample.xcconfig"
build_version_property = "BUILD_VERSION"
new_version_string = ""
lines = IO.readlines(filename)
@lemonkey
lemonkey / gist:637e855e0ba118a50218
Last active June 9, 2017 18:39
Swift 2 and Objective-C Interoperability Review

Using Swift 2 and Objective-C classes within frameworks, apps and unit tests

Normal Usage:

  • Swift into Obj-C:
    • Within framework or app:
      • Because the auto generated Swift interface header "Objective-C Generated Interface Header" SWIFT_OBJC_INTERFACE_HEADER_NAME for a framework target is part of the framework’s public interface, only Swift declarations marked with the public modifier for classes or structs marked with @objc appear in this header for a framework target.
        • Framework:
          • #import <ProductName/ProductModuleName-Swift.h>
          • This could go in the Framework’s prefix PCH file if used as a local dev pod, otherwise not recommended (reserve PCH for things that don’t change often like UIKit, etc.)
  • Note: You can still use Swift methods and properties that are marked with the internal modifier from within the ObjC part of your framework, as long they are declared within a Swift class that inherits from an ObjC class.
@lemonkey
lemonkey / podinstall-before_classes.log
Last active November 23, 2015 00:02
pod install log for https://github.com/CocoaPods/CocoaPods/issues/4570, before sample classes added to Pod1 and Pod2 Cocoa Touch Frameworks
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods`: (``)
Using `ARCHS` setting to build architectures of target `Pods-Main`: (``)
Using `ARCHS` setting to build architectures of target `Pods-MainTests`: (``)
Fetching external sources
-> Fetching podspec for `Pod1` from `./Pod1`
-> Fetching podspec for `Pod2` from `./Pod1/Pod2`
@lemonkey
lemonkey / podinstall-after_classes.log
Last active November 23, 2015 00:03
pod install log for https://github.com/CocoaPods/CocoaPods/issues/4570, after sample classes added to Pod1 and Pod2 Cocoa Touch Frameworks
Analyzing dependencies
Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods`: (``)
Using `ARCHS` setting to build architectures of target `Pods-Main`: (``)
Using `ARCHS` setting to build architectures of target `Pods-MainTests`: (``)
Finding Podfile changes
- Pod1
- Pod2
@lemonkey
lemonkey / gist:cc9d807a7b6ecd0cac33
Created January 19, 2016 20:04
MH: Adding Swift Support to hAPITracker key milestones
* 001: Upgrade to CocoaPods v0.39 and fix custom post install steps in Podfiles, etc. (Mon 11/16) (Wed 11/18)
* 002: Add use_frameworks! to hAPITracker and SS Podfile and investigate problems (Mon 11/16) (Thu 11/19)
* 003: Upgrade 3rd party dependencies as needed (Wed 11/18) (Thu 11/26)
* 004: Create new blank hAPITrackerFramework using Cocoa Touch Framework Xcode project (Thu 11/19) (Thu 11/19)
* 005: Turn hAPITrackerFramework into a CocoaPod that is used as a local dev pod only (no specs repo) (Thu 11/19) (Thu 11/19)
* 006: Create new blank iOS app that has hAPITrackerFramework as a dependency, with use_frameworks! (Thu 11/19) (Thu 11/19)
* 007: Add a unit test to hAPITrackerFramework and make sure it can run (Thu 11/19) (Thu 11/19)
* 008: Add a unit test to new blank iOS app and make sure it can run (Thu 11/19) (Thu 11/19)
* 009: Add all 3rd party pods to hAPITrackerKit (Fri 11/20) (Thu 11/26)
* 010: Add static libraries and source from libs folder from existing hAPITracker to new framework (TN, Google Ana
@lemonkey
lemonkey / fetchThingsWithCompletion.m
Created October 28, 2016 01:13 — forked from quellish/fetchThingsWithCompletion.m
Pseudo-sample of a core data fetch with a completion block.
- (void) fetchThingsWithCompletion:(void (^)(NSArray *, NSError *))completion{
[context performBlock:^{
result = [context executeFetch:...
if (completion != nil){
completion(result, error);
}
}];
}
@lemonkey
lemonkey / waitForBlock.m
Created October 28, 2016 01:14 — forked from quellish/waitForBlock.m
Pseudo-sample of synchronous use of Core Data performBlock: using dispatch group
group = dispatch_group_create();
dispatch_group_enter(group);
[context performBlock:^{
result = [context executeFetch:...
dispatch_group_leave(group);
}];
groupResult = dispatch_group_wait(group, DISPATCH_TIME_FOREVER);