Skip to content

Instantly share code, notes, and snippets.

View Kevinwlee's full-sized avatar

Kevin Lee Kevinwlee

View GitHub Profile
@Kevinwlee
Kevinwlee / get-items.mm
Last active August 29, 2015 14:03
Retrieving items with tags
[[CCHVault sharedInstance] getItemWithTags:@[@"demo"] completionHandler:^(NSArray *responses, NSError *error) {
if (error) {
//handle errors
} else {
//work with the responses
}
}];
@Kevinwlee
Kevinwlee / get-item.mm
Last active August 29, 2015 14:03
Retrieving an item from vault
[[CCHVault sharedInstance] getItemWithId:@"ITEM-ID" completionHandler:^(NSDictionary *response, NSError *error) {
if (error) {
//handle errors
} else {
//work with your data
}
}];
@Kevinwlee
Kevinwlee / create-item.mm
Last active August 29, 2015 14:03
Adding an item to Vault
[[CCHVault sharedInstance] createItem:item tags:@"demo" completionHandler:^(NSDictionary *response, NSError *error) {
//Returns NSDictionary with info in data key
}];
@Kevinwlee
Kevinwlee / push-tags.mm
Last active August 29, 2015 14:03
Sending a push to tags
[[CCHPush sharedInstance] sendNotificationToTags: userInfo: completionHandler:^(NSError *error) {}];
@Kevinwlee
Kevinwlee / push-aliases.mm
Last active August 29, 2015 14:03
Sending a push to aliases
[[CCHPush sharedInstance] sendNotificationToAliases: userInfo: completionHandler:^(NSError *error) {}];
@Kevinwlee
Kevinwlee / push-devices.mm
Last active August 29, 2015 14:03
Sending a push to devices
[[CCHPush sharedInstance] sendNotificationToDevices: userInfo: completionHandler^(NSError *error): {}];
@Kevinwlee
Kevinwlee / push-registration.mm
Last active August 29, 2015 14:03
Register for push
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
@Kevinwlee
Kevinwlee / context-rule.js
Last active August 29, 2015 14:03
Sample context rule
var deviceName = event.context[2].device_context.name
var event = deviceName + " triggered a geofence_in event"
Console.log(event)
var eventData = {"deviceName":deviceName, "event":"geofence_in"}
Vault.create(eventData, "geofence-tag")
@Kevinwlee
Kevinwlee / device-context.mm
Last active August 29, 2015 14:03
Sample device context
"device_context" = {
"device_id" = "BEE8D95B-01FF-4835-8A71-F1D89A39771C";
model = "iPhone Simulator";
name = "iPhone Simulator";
"system_name" = "iPhone OS";
"system_version" = "7.1";
type = iPhone;
};
@Kevinwlee
Kevinwlee / motion-changed.mm
Last active August 29, 2015 14:03
Sample motion changed event
data = {
"current_activity" = {
activities = (
stationary
);
confidence = 2;
"start_date" = "2014-03-26 21:32:51 +0000";
};
"previous_activity" = {
activities = (