Skip to content

Instantly share code, notes, and snippets.

David Starr dstarr

Block or report user

Report or block dstarr

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
dstarr / gulpfile.js
Created Jun 17, 2016
My gulpfile.js ensuring nodemon doesn't leave a hanging Node.js process when interrupted.
View gulpfile.js
const gulp = require('gulp');
const nodemon = require('gulp-nodemon');
gulp.task('default', launchServer);
function launchServer() {
var restart_called = false;
var nm = nodemon({
View ColorSwatch.js
import React from 'react';
import PropTypes from 'prop-types';
const ColorSwatch = (props) => {
let style = {
backgroundColor: props.color,
return (
View ColorSwatchClass.js
import React from 'react';
import PropTypes from 'prop-types';
class ColorSwatchClass extends React.Component {
constructor(props) {
dstarr / SensorTick.cs
Created Mar 6, 2018
Simple Entity for Sensor Data
View SensorTick.cs
public class SensorTick
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
[JsonProperty(PropertyName = "temperature")]
public int Temperature { get; set; }
[JsonProperty(PropertyName = "humidity")]
public int Humidity { get; set; }
dstarr / Program.cs
Created Mar 6, 2018
Provision Azure Cosmos DB if needed
View Program.cs
private async Task ProvisionDbIfNeeded()
await client.CreateDatabaseIfNotExistsAsync(new Database { Id = dbName });
await client.CreateDocumentCollectionIfNotExistsAsync(
new DocumentCollection { Id = collectionName }
View Cosmos_2.cs
private async Task AddSensorData()
SensorTickerFactory sensorTickerFactory = new SensorTickerFactory();
for (int i = 0; i < 10; i++)
var tick = sensorTickerFactory.GetSensorTick();
await AddSensorTickIfNotExists(tick);
dstarr / Program3.cs
Last active Mar 7, 2018
Updating the docs my adding 100 degrees to the temperature.
View Program3.cs
private void DeleteAllDocs()
List<SensorTick> ticks = _client.CreateDocumentQuery<SensorTick>(_dbcUri).ToList();
foreach (var tick in ticks)
Uri docUri = UriFactory.CreateDocumentUri(DbName, CollectionName, tick.Id);
Console.WriteLine(@"Deleted: {0}", tick.Id);
dstarr / Cosmos_4_ModifyDocs.cs
Last active Mar 7, 2018
Deleting all the files in the Azure Cosmos DB,
View Cosmos_4_ModifyDocs.cs
private async Task ModifyAllDocs()
List<SensorTick> docs = _client.CreateDocumentQuery<SensorTick>(_dbcUri).ToList();
foreach (var doc in docs)
doc.Temperature += 100;
Uri docUri = UriFactory.CreateDocumentUri(DbName, CollectionName, doc.Id);
await _client.ReplaceDocumentAsync(docUri.ToString(), doc);
Console.WriteLine(@"Updated: {0}", doc.Id);
dstarr /
Created Jun 18, 2019
Provisions an app gateway and a scale set
#!/bin/bash -e
set -e
You can’t perform that action at this time.