Skip to content

Instantly share code, notes, and snippets.

View rcoh's full-sized avatar

Russell Cohen rcoh

View GitHub Profile
@rcoh
rcoh / registeraction.m
Created July 23, 2013 17:11
Register Action for Ink
INKAction *returnAction = [INKAction action:@"Return" type:INKActionType_Return];
[INKCore registerAction:returnAction withBlock:^(INKBlob *blob, NSError *error) {
NSLog(@"Return");
//Code to handle the returned blob
}];
INKAction *returnCancelAction = [INKAction action:@"ReturnCancel" type:INKActionType_ReturnCancel];
[INKCore registerAction:returnCancelAction withBlock:^(INKBlob *blob, NSError *error) {
NSLog(@"Return Cancel");
}];
@rcoh
rcoh / enableview.m
Last active December 20, 2015 03:29
Enabling a View
[self.view INKEnableWithUTI:myFile.uti dynamicBlob:^INKBlob *{
INKBlob *blob = [INKBlob blobFromData:[myFile getData]];
blob.uti = myFile.uti;
blob.filename = myFile.fileName;
return blob;
} returnBlock:^(INKBlob *blob, INKAction *action, NSError *error) {
if ([action.type isEqualToString: INKActionType_Return]) {
// Return save action. Save back the blob
} else {
// Return cancel action
#import <Ink/Ink.h>
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[INKCore runBackgroundProcess];
/*Your code here*/
}
@rcoh
rcoh / openurl.m
Last active December 20, 2015 03:29
//This method is used instead of the handleOpenURL method because it is depreciated in iOS 6 and only one of the methods can be used
-(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
if ([Ink openURL:url sourceApplication:sourceApplication annotation:annotation]) {
return YES;
}
// Add whatever other url handling code your app requires here
return NO;
}
@rcoh
rcoh / actions.json
Last active December 20, 2015 03:29
Update actions.json
{
"actions": [
{...},
{...},
{
"id": 2,
"uuid": "abcdefg",
"name": "Sign in PDFSign",
"call_to_action": "Sign",
"description": "This will save a file",
@rcoh
rcoh / inkimports.m
Last active December 20, 2015 03:29
#import <INK/Ink.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Ink setupWithAppKey:@"your-appkey-here"];
/*Your app's intialization code here*/
}
for (loop_cond) {
int x = 2;
if (x > 1) {
x = -5;
}
print(x);
}
// If we hoist x = 2, then we'll only print once
// If we don't we'll print every time.
try:
thrower()
except (Exception1, Exception2):
print DoStuff