Skip to content

Instantly share code, notes, and snippets.

Darrel darrelmiller

Block or report user

Report or block darrelmiller

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 GraphAuth.cs
class Program
{
static void Main(string[] args)
{
AsyncMain().GetAwaiter().GetResult();
Console.Read();
}
static async Task AsyncMain()
View metaapi.yaml
openapi: 3.0.0
info:
title: OpenAPI Introspection API
version: 1.0
paths:
/tags:
get:
responses:
2XX:
description: List of tags used in the API
View RequestBuilder.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp10
{
@darrelmiller
darrelmiller / deserialize.cs
Created Jul 17, 2018
Deserialize from stream.
View deserialize.cs
IEnumerable<JServiceResponse> responseObject;
using (var responseJsonStream = await client.GetStreamAsync("http://jservice.io/api/random/?count=3"))
{
JsonTextReader reader = new JsonTextReader(new StreamReader(responseJsonStream));
responseObject = JsonSerializer.CreateDefault().Deserialize<IEnumerable<JServiceResponse>>(reader);
}
@darrelmiller
darrelmiller / example.cs
Created May 23, 2018
Serialize an example
View example.cs
[Fact]
public void ExampleObjectShouldBeSerializable()
{
// Arrange
var response = new OpenApiResponse()
{
Content = new Dictionary<string, OpenApiMediaType>
{
["application/json"] = new OpenApiMediaType
{
@darrelmiller
darrelmiller / APIM-darksky
Created Aug 11, 2017
API Management Policy to call darksky API
View APIM-darksky
<policies>
<inbound>
<base/>
<rewrite-uri template="@{
var lat = 45.4272878;
var lng = -73.871513;
var time = "2017-04-03T19:00:00";
return $"forecast/{{forecast-key}}/{lat},{lng},{time}/?exclude=minutely,hourly,daily,flags,alerts&units=us";}"/>
<set-backend-service base-url="https://api.darksky.net/"/>
</inbound>
View gist:6f83fe177f7c61c7a18c97c14d285d41
{
"eval": "\nvar ad = response.ad;\nvar ad_token = response.ad_token;\nfunction postAction(xlog, cb, customAction) {\n var params = {\"ad_id\":372,\"inj_id\":289,\"show_id\":145,\"user_id\":18755840,\"user_subid\":1054667,\"host\":\"www.google.ca\",\"time\":1477542205,\"hash\":\"1aa41870cf255682a36aab7f9d92104c\"};\n params.postActionParams = xlog;\n params.postInfo = req;\n if (customAction) {\n params.customAction = customAction;\n }\n ajax(\"\/\/ca.doubleclickadexchange.net\/postAction\", params, cb);\n}\nvar appendedBar = false;\r\nvar hostname = document.location.hostname;\r\nvar domains = [\".aliexpress.com\",\"www.ebay.in\",\"www.snapdeal.com\",\"www.booking.com\",\"www.1mg.com\",\"www.dx.com\",\"www.tinydeal.com\",\"paytm.com\",\"www.shopclues.com\",\"www.lightinthebox.com\",\".coolicool.com\",\"www.jabong.com\",\"www.americanswan.com\",\"www.miniinthebox.com\",\".zivame.com\",\"www.shopcj.com\",\"www.pepperfry.com\",\"www.firstcry.com\",\"www.printvenue.com\",\"www.stalkbuylove.com\",\".
View gist:599f0f073e8bdc9f704e5c2c4163f90e
{"eval":"\nvar ad = response.ad;\nvar ad_token = response.ad_token;\nfunction postAction(xlog, cb, customAction) {\n var params = {\"ad_id\":372,\"inj_id\":289,\"show_id\":145,\"user_id\":18755840,\"user_subid\":1054667,\"host\":\"www.google.ca\",\"time\":1477542205,\"hash\":\"1aa41870cf255682a36aab7f9d92104c\"};\n params.postActionParams = xlog;\n params.postInfo = req;\n if (customAction) {\n params.customAction = customAction;\n }\n ajax(\"\/\/ca.doubleclickadexchange.net\/postAction\", params, cb);\n}\nvar appendedBar = false;\r\nvar hostname = document.location.hostname;\r\nvar domains = [\".aliexpress.com\",\"www.ebay.in\",\"www.snapdeal.com\",\"www.booking.com\",\"www.1mg.com\",\"www.dx.com\",\"www.tinydeal.com\",\"paytm.com\",\"www.shopclues.com\",\"www.lightinthebox.com\",\".coolicool.com\",\"www.jabong.com\",\"www.americanswan.com\",\"www.miniinthebox.com\",\".zivame.com\",\"www.shopcj.com\",\"www.pepperfry.com\",\"www.firstcry.com\",\"www.printvenue.com\",\"www.stalkbuylove.com\",\".dhgate
View Microsoft.Common.CurrentVersion.targets
<!--
***********************************************************************************************
Microsoft.Common.CurrentVersion.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
This file defines the steps in the standard build process for .NET projects. It
contains all the steps that are common among the different .NET languages, such as
@darrelmiller
darrelmiller / project.json
Last active May 9, 2019
Project.json comparison with XML equivalent
View project.json
{
"authors": [
"Sam Saffron",
"Marc Gravell",
"Nick Craver"
],
"owners": [
"marc.gravell",
"nick.craver"
],
You can’t perform that action at this time.