Skip to content

Instantly share code, notes, and snippets.

View Kevinwlee's full-sized avatar

Kevin Lee Kevinwlee

View GitHub Profile
@Kevinwlee
Kevinwlee / did-receive.mm
Last active August 29, 2015 14:03
Tell contextHub when a push is received
[[CCHPush sharedInstance] application:application didReceiveRemoteNotification:userInfo completionHandler:completionHandler];
@Kevinwlee
Kevinwlee / sample-event.mm
Last active August 29, 2015 14:03
Sample event
{
event = {
context = (
{
"location_context" = {
"location_context" = {
altitude = 0;
course = 0;
datetime = "2014-03-26 20:07:41 +0000";
"device_id" = "BEE8D95B-01FF-4835-8A71-F1D89A39771C";
@Kevinwlee
Kevinwlee / beacon-in-event.mm
Last active August 29, 2015 14:03
Sample beacon in event
data = {
altitude = "21.54464340209961";
beacon = {
major = "";
minor = "";
name = JP;
uuid = "E2C56DB5-DFFB-48D2-B060-8876223462A3";
};
course = "-1";
datetime = "2014-03-26 20:38:20 +0000";
@Kevinwlee
Kevinwlee / beacon-changed.mm
Last active August 29, 2015 14:03
Sample beacon changed event
data = {
altitude = "18.16732978820801";
beacon = {
major = 32872;
minor = 7821;
proximity = "immediate_state";
rssi = "-40";
uuid = "E2C56DB5-DFFB-48D2-B060-8876223462A3";
};
course = "-1";
@Kevinwlee
Kevinwlee / geofence-in.mm
Last active August 29, 2015 14:03
Sample geofence in event
data = {
altitude = 0;
course = "-1";
datetime = "2014-03-26 21:20:24 +0000";
"device_id" = "BEE8D95B-01FF-4835-8A71-F1D89A39771C";
fence = {
id = sandcreek;
latitude = "30.054381";
longitude = "-95.17071199999999";
radius = 100;
@Kevinwlee
Kevinwlee / location-changed.mm
Last active August 29, 2015 14:03
Sample location changed event
data = {
altitude = 0;
course = 0;
datetime = "2014-03-26 20:07:41 +0000";
"device_id" = "BEE8D95B-01FF-4835-8A71-F1D89A39771C";
latitude = 0;
longitude = 0;
speed = 0;
};
@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 = (
@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 / 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 / push-registration.mm
Last active August 29, 2015 14:03
Register for push
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];