Instantly share code, notes, and snippets.

View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<title>Document</title>
<style>
View gist:066593af4161e3f7218dfca5085c7b72
using syron.ETagHelper;
using System.Net;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
// parse query parameter
string name = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
View gist:a7009128e44ca5f1f23eb89aa5395c38
{
"data": [
{
"_self": "http://myapiurl/data/3",
"id": 3,
"name": "Test3",
"description": "Hello MA"
},
{
"_self": "http://myapiurl/data/4",
View gist:2472245089d3f71692305364797c5291
{
"error": {
"code": 123,
"title": "login failed",
"message": "Lorem ipsum dolor sit amet..."
}
}
View gist:cc50fb6ba76cd831962955f27acf1a78
{
"data": {
"_self": "http://myapiurl/data/1",
"id": 1,
"name": "Test",
"description": "Hello World"
}
}
View Program.cs for debugging a windows service.
static void Main()
{
#if (!DEBUG)
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
#else
Service1 service = new Service1();
service.Init();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
View Windows Service default Main method.
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
View Azure Function App - Storage Account - Invocation Log
string connectionString = ConfigurationManager.AppSettings["StorageConnectionString"];
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable table = tableClient.GetTableReference("AzureFunctionsLogTable");
TableQuery<DynamicTableEntity> query = new TableQuery<DynamicTableEntity>();
foreach (var t in table.ExecuteQuery(query))
View Azure Function App Folder Structure
/FunctionName01
/function.json
/run.csx
/FunctionName02
/function.json
/run.csx
/FunctionName03
/function.json
/run.csx
/host.json
View Azure Function Email C# Snippet
#r "Newtonsoft.Json"
using System;
using System.Net;
using Newtonsoft.Json;
using System.Net.Mail;
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
{
log.Verbose($"Webhook was triggered!");