Skip to content

Instantly share code, notes, and snippets.

View Kevinwlee's full-sized avatar

Kevin Lee Kevinwlee

View GitHub Profile
@Kevinwlee
Kevinwlee / http-firebase-garage-door.ino
Last active April 5, 2018 23:35
Thing Dev Board Garage Door
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <FirebaseArduino.h>
// Firebase info
const char FIREBASE_HOST[] = "YOUR_FIREBASE_HOST_HERE.firebaseio.com";
const char FIREBASE_AUTH[] = "YOUR_FIRBASE_ADMIN_KEY";
//wifi info
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
// Set these to run example.
#define FIREBASE_HOST ""
#define FIREBASE_AUTH ""
#define WIFI_SSID ""
#define WIFI_PASSWORD ""
@Kevinwlee
Kevinwlee / pem.md
Created February 2, 2016 15:13
Creating PEMs for ContextHub

Certificates

Before you can use the push services you will need to create a Production and Sandbox push certificate for you application.

After you have downloaded your push certificates, you will need to create a PEM file out of both of them.

  1. Open the Keychain Access application and select your production certificate and its private key.
  2. From the File menu select "Export Items..."
  3. Name the export "Certificates.p12" and save them to your desktop.
  4. Open a terminal window and change directories to your Desktop
@Kevinwlee
Kevinwlee / removeSubscrptions.mm
Last active August 29, 2015 14:04
Remove subscriptions
[[CCHSubscriptionService sharedInstance] removeSubscriptionsForTags:@[@"tag3"] options:@[CCHOptionVault, CCHOptionGeofence] completionHandler:^(NSError * error) {
if(!error) {
//your subscriptions were removed.
}
}];
@Kevinwlee
Kevinwlee / addSubscription.mm
Created July 15, 2014 14:16
Add a subscripton for tags
[[CCHSubscriptionService sharedInstance] addSubscriptionsForTags:@[@"tag1", @"tag2", @"tag3"] options:nil completionHandler:^(NSError * error) {
if(!error) {
//you subscriptions were created.
}
}];
@Kevinwlee
Kevinwlee / getItemsWithKeyPath.mm
Created July 14, 2014 15:53
Get items that contain a key path
[[CCHVault sharedInstance] getItemsWithTags:@[@"sample-tag"] keyPath:@"employee.first_name" value:nil completionHandler:^(NSArray *responses, NSError *error) {
if (error) {
//handle errors
} else {
//the responses will contain all vault items that have the key path employe.first_name
}
}];
@Kevinwlee
Kevinwlee / getItemsKeyPath.mm
Last active August 29, 2015 14:03
Get items by tag and key path
[[CCHVault sharedInstance] getItemsWithTags:@[@"sample-tag"] keyPath:@"employee.first_name" value:@"Gaurav" completionHandler:^(NSArray *responses, NSError *error) {
if (error) {
//handle errors
} else {
//work with the responses
}
}];
@Kevinwlee
Kevinwlee / vault-item.mm
Last active August 29, 2015 14:03
Sample vault item
NSDictionary *item = @{@"uuid":@"BEACON-UUID", @"major":@100, @"minor":@1,@"associatedData":@"This beacon is placed near the entrance to ChaiOne"};
@Kevinwlee
Kevinwlee / delete-item.mm
Last active August 29, 2015 14:03
Deleting an item from the vault
[[CCHVault sharedInstance] deleteItem:item completionHandler:^(NSDictionary *response, NSError *error) {}];
@Kevinwlee
Kevinwlee / update-item.mm
Last active August 29, 2015 14:03
Updating an item in the vault
[[CCHVault sharedInstance] updateItem:item completionHandler:^(NSDictionary *response, NSError *error) {}];