Skip to content

Instantly share code, notes, and snippets.

View nickharris's full-sized avatar

Nick Harris nickharris

View GitHub Profile
nickharris / gist:4950450
Created February 14, 2013 03:39
insert sensor reading from .NET MF to Mobile Services
void temperatureHumidity_MeasurementComplete(TemperatureHumidity sender, double temperature, double relativeHumidity)
//may as well take a light reading as well
double lightPercentage = lightSensor.ReadLightSensorPercentage();
//create a new sensor reading and set the values
var reading = new SensorReading()
SensorID = "nicks-office", //can you believe i have to share my office with ?
Temp = temperature,
nickharris / gist:4950428
Last active December 13, 2015 17:48
SensorData Insert Script
var Pusher = require('pusher');
function insert(item, user, request) {
success: function() {
// After the record has been inserted, trigger immediately to the client
// Publish event for all other active clients
nickharris / gist:4950398
Last active December 13, 2015 17:48
pusher and jqplot implementation for live graphs
ViewBag.Title = ".NET MicroFramework, Mobile Services + Pusher demo";
<h2>Mobile Services - Sensor Demo</h2>
<div id="chartdiv" style="height:600px;width:800px;display:none"></div>
<br />
<div id="lightdiv" style="height:600px;width:800px;display:none"></div>
<!DOCTYPE html>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
@*Add Pusher script reference*@
<script type="text/javascript" src="" />
public partial class Program
private GT.Timer timer = new GT.Timer(5000);
void ProgramStarted()
// Event that fires when a measurement is ready
temperatureHumidity.MeasurementComplete += new TemperatureHumidity.MeasurementCompleteEventHandler(temperatureHumidity_MeasurementComplete);
ethernet_J11D.Interface.NetworkAddressChanged += new NetworkInterfaceExtension.NetworkAddressChangedEventHandler(Interface_NetworkAddressChanged);
ethernet_J11D.DebugPrintEnabled = true;
nickharris / gist:4949948
Last active December 13, 2015 17:39
create MobileServiceClient instance
using Microsoft.WindowsAzure.MobileServices;
namespace SensorDemoMobileServices
public partial class Program
//TODO: add your mobile service URI and app key below from the Windows Azure Portal
public static MobileServiceClient MobileService = new MobileServiceClient(
new Uri("http://<your Windows Azure Mobile Service subdomain >"),
"<your Windows Azure Mobile Service App Key> "
nickharris / gist:4949513
Last active December 13, 2015 17:38
Gadgeteer collect sensor data and insert to mobile service
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
using Gadgeteer.Networking;
nickharris / gist:4949367
Last active December 13, 2015 17:38
using System;
using Microsoft.SPOT;
using Microsoft.Azure.Zumo.MicroFramework.Core;
namespace SensorDemoMobileServices
public class SensorReading : IMobileServiceEntity
public int Id { get; set; }
public string SensorID { get; set; }
nickharris / gist:4357369
Created December 22, 2012 03:34
Windows Azure Mobile Services Scheduler
function CheckFeed() {
var request = require('request');
function getUpdatesAndNotify() {
function tweetsLoaded (error, response, body) {
var results = JSON.parse(body).results;
var azure = require('azure');
var qs = require('querystring');
function insert(item, user, request) {
var accountName = '<replace with your storage account name>';
var accountKey = '<replace with your storage account key>';
var host = accountName + '';
var canonicalizedResource = '/' + item.containerName + '/' + item.resourceName;
//Must be lowercase
item.containerName = item.containerName.toLowerCase();