Skip to content

Instantly share code, notes, and snippets.

Lohith lohithgn

View GitHub Profile
View AsyncMainProgram.cs
class Program
{
static async Task Main(string[] args)
{
//Create Client
//Create Database
//Create Collection
//Create Document(s)
//Query Document
//Delete Database
View cosmosdeleteddb.cs
await client.DeleteDatabaseAsync(UriFactory.CreateDatabaseUri(dbName));
View cosmosdocumentquery.cs
//Query Document
Volcano rainierVolcano = client.CreateDocumentQuery<Volcano>(
UriFactory.CreateDocumentCollectionUri(dbName,collectionName))
.Where(v => v.VolcanoName == "Rainier")
.AsEnumerable()
.FirstOrDefault();
View cosmosdocumentcreate.cs
//create document
var volcano = new Volcano
{
VolcanoName = "Rainier",
Country = "United States",
Region = "US-Washington",
Location = new Location
{
Type = "Point",
Coordinates = new double[] { -121.758, 46.87 }
View cosmoscreatecollection.cs
//Create Collection
var collection = await client.CreateDocumentCollectionIfNotExistsAsync(
UriFactory.CreateDatabaseUri(dbName),
new DocumentCollection { Id = collectionName }
);
View createdatabase.cs
//Create Database
var database = await client.CreateDatabaseIfNotExistsAsync(
new Database { Id = dbName });
View cosmosdbclient.cs
string endpointUri = "https://localhost:8081";
string authKey = "<auth key>";
string dbName = "VolcanoesDB";
string collectionName = "Volcanoes";
using (DocumentClient client = new DocumentClient(new Uri(endpointUri), authKey))
{
//...
}
@lohithgn
lohithgn / kendouichart_3.html
Created Nov 22, 2016
Kendo UI Chart - custom series colors
View kendouichart_3.html
<script>
function createChart() {
$("#chart").kendoChart({
title: {
text: "Gross domestic product growth \n (GDP annual %)"
},
seriesColors:['#b71c1c','#1a237e','#004d40'],
//ommitted for brevity...
});
}
@lohithgn
lohithgn / kendouichart_2.html
Created Nov 22, 2016
Kendo UI Chart - instantiatig the chart
View kendouichart_2.html
<script>
function createChart() {
$("#chart").kendoChart({
title: {
text: "Gross domestic product growth \n (GDP annual %)"
},
seriesDefaults: {
type: "area",
area: {
line: {
@lohithgn
lohithgn / kendouichart.html
Created Nov 22, 2016
Kendo UI Data Viz - Chart
View kendouichart.html
<div id="chart"></div>
You can’t perform that action at this time.