var app = WebApplication.Create(args);
app.MapGet("/", () => "Hello World");
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CSSIsolationActionFilterAttribute : ActionFilterAttribute | |
{ | |
public CSSIsolationActionFilterAttribute() | |
{ | |
} | |
public override void OnResultExecuted(ResultExecutedContext filterContext) | |
{ | |
ViewResult viewResult = filterContext.Result as ViewResult; | |
RazorView view = viewResult?.View as RazorView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"showSecondCTA": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const express = require('express'); | |
// Constants | |
const PORT = 8095; | |
const HOST = '0.0.0.0'; | |
// App | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static readonly AzureKeyCredential Credentials = new AzureKeyCredential("KEY"); | |
private static readonly Uri Endpoint = new Uri("ENDPOINT"); | |
private static readonly string SearchApiKey = "KEY"; | |
private static readonly string BitlyKey = "KEY"; | |
private static readonly string TwitterConsumerKey = "CONSUMERKEY"; | |
private static readonly string TwitterConsumerSecret = "CONSUMERSECRET"; | |
private static readonly string TwitterAccessToken = "ACCESSTOKEN"; | |
private static readonly string TwitterAccessTokenSecret = "ACCESSTOKENSECRET"; | |
private static readonly string[] searchTerms = new[] { "Application Technology", "Architecture", | |
"Artificial Intelligence", "Open Source", "SAAS", "Business Transformation", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add reference of Microsoft.Azure.CognitiveServices.Search.NewsSearch Package | |
using Microsoft.Azure.CognitiveServices.Search.NewsSearch; | |
public static async Task<News> GetSearchResults(string searchTerm) | |
{ | |
var searchClient = new NewsSearchClient(new ApiKeyServiceClientCredentials(SearchApiKey)); | |
return await searchClient.News.SearchAsync(query: searchTerm, market: "en-us", count: 5); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add reference of Tweetinvi | |
using Tweetinvi; | |
using Tweetinvi.Models; | |
public static void CreateTweet(string text) | |
{ | |
var credentials = new TwitterCredentials(TwitterConsumerKey, | |
TwitterConsumerSecret, | |
TwitterAccessToken, | |
TwitterAccessTokenSecret); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add reference of Azure.AI.TextAnalytics | |
using Azure; | |
using Azure.AI.TextAnalytics; | |
using Microsoft.Azure.CognitiveServices.Search.NewsSearch.Models; | |
public static async Task<string> GetKeywords(string text) | |
{ | |
var client = new TextAnalyticsClient(Endpoint, Credentials); | |
var response = await client.ExtractKeyPhrasesAsync(text); | |
var tags = new List<string>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add reference of BitlyAPI package | |
public static async Task<string> CreateShortURL(string url) | |
{ | |
var bitly = new BitlyAPI.Bitly(BitlyKey); | |
var shortLink = await bitly.PostShortenLink(url); | |
return shortLink; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kbServiceUrl = "https://appservice.azurewebsites.net/qnamaker/knowledgebases/id/generateAnswer"; | |
var kbAuthKey = "authkey"; | |
var answer = string.Empty; | |
using (var httpClient = httpClientFactory.CreateClient()) | |
{ | |
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); | |
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("EndpointKey", kbAuthKey); | |
var question = new JObject(); | |
question["question"] = cmd; | |
var questionContent = new StringContent(question.ToString(), Encoding.UTF8, "application/json"); |
NewerOlder