Skip to content

Instantly share code, notes, and snippets.

Eric Jones erjjones

  • Indianapolis, Indiana
Block or report user

Report or block erjjones

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View odatahq-query-data-in-workspace-sample
// Create a session for the workspace specified in the configuration.
using (var session = new WorkspaceSession(_configuration))
{
// We'll authenticate using standard workspace token authentication with an example user.
await session.AuthenticateAsync("{username}", "{password}");
// Insert example documents to ensure we have something to query.
await session.InsertDocumentAsync(new AnonymousCollection
{
DocumentID = Guid.NewGuid().ToString(),
@erjjones
erjjones / odatahq-store-data-then-delete-sample
Created Jun 29, 2015
Store Data In a Workspace Then Delete
View odatahq-store-data-then-delete-sample
// Create a session for the workspace specified in the configuration.
using (var session = new WorkspaceSession(configuration))
{
// We'll authenticate using standard workspace token authentication with an example user.
await session.AuthenticateAsync("{username}", "{password}");
var anonymousDocument = new AnonymousCollection
{
DocumentID = Guid.NewGuid().ToString(),
Name = "Example Inserted Document"
View odatahq-store-data-in-workspace-sample
// Create a session for the workspace specified in the configuration.
using (var session = new WorkspaceSession(configuration))
{
// Define a new user to be registered, notice that we don't need to assign any audit column values.
var user = new User
{
DocumentID = Guid.NewGuid().ToString(),
Username = "someusername",
Password = "s@m5p@ssw@rd" // Password will automatically be MD5'd using a trigger on the server.
};
@erjjones
erjjones / odatahq-workspace-configuration-user-scope-sample
Created Jun 29, 2015
Define Workspace Configuration With a User in Scope
View odatahq-workspace-configuration-user-scope-sample
var configuration = new WorkspaceConfiguration
{
QueryServiceUri = new Uri("https://query.odatahq.com/v3/{accountKey}/{workspaceUri}", UriKind.Absolute),
ClientID = "{clientId}",
ClientSecret = "{clientSecret}",
Username = "{username}",
Password = "{password}"
};
View odatahq-workspace-configuration-sample
var configuration = new WorkspaceConfiguration
{
QueryServiceUri = new Uri("https://query.odatahq.com/v3/{accountKey}/{workspaceUri}", UriKind.Absolute),
ClientID = "{clientId}",
ClientSecret = "{clientSecret}"
};
@erjjones
erjjones / garagedoor
Created Aug 28, 2014
Garage Door Collection Metadata
View garagedoor
{
"collectionUri": "garagedoor",
"title": "garagedoor",
"description": "Collection of garagedoor objects.",
"typeName": "garagedoor",
"enableTriggers": false,
"properties": [
{
"name": "Status",
"description": "",
@erjjones
erjjones / GarageDoor-Agent
Last active Aug 29, 2015
Home Monitor Garage Door Electric Imp Device
View GarageDoor-Agent
const ODATAHQ_URL = "https://query.odatahq.com/v3/{accountkeyhere}/homemonitor/garagedoor?api-key={apikeyhere}";
// Print light reading trigger URL
server.log("Sensor Agent URL: " + http.agenturl());
// Define funtions
function requestHandler(request, response)
{
// Handle an incoming web request for a reading
try
@erjjones
erjjones / Triggers
Created Aug 27, 2014
Default Trigger Class
View Triggers
using System;
using ODataHQ.Code.Common;
public class Triggers : ITriggers
{
public void Create(ExecutionContext context)
{
context.Execute();
}
View guide-workspaces-sample.json
{
"WorkspaceUri": "Sample",
"Title": "Sample Title",
"Description": "This is a sample workspace.",
"Anonymous": false,
"EnableTriggers": false,
"Records": 0,
"Collections": [
{
"CollectionUri": "Products",
@erjjones
erjjones / electric_imp_system_ping
Last active Dec 11, 2015
Awake Imp post JSON payload
View electric_imp_system_ping
function getDateTime(){
local d = date();
local datestring = format("%04d-%02d-%02dT%02d:%02d:%02d", d.year, d.month+1, d.day, d.hour, d.min, d.sec); //ISO 8601
return datestring;
}
class RespInput extends InputPort
{
name = "response";
type = "string";
You can’t perform that action at this time.