Skip to content

Instantly share code, notes, and snippets.

View GeradeDev's full-sized avatar
🖖
Merging without reviewing.

Gerade Geldenhuys GeradeDev

🖖
Merging without reviewing.
View GitHub Profile
- task: RunARMTTKTests@1
inputs:
templatelocation: '$(System.DefaultWorkingDirectory)\*'
resultLocation: '$(System.DefaultWorkingDirectory)'
{
"condition": "[equals(parameters('newOrExisting'),'new')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2017-06-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "[variables('storageAccountType')]"
},
"kind": "Storage",
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"StorageAccountName": {
"type": "String",
"defaultValue": "storage2020"
}
},
"variables": {
"functions": [
{
"namespace": "finance",
"members": {
"prefixDepartment": {
"parameters": [
{
"name": "resourceName",
"type": "string"
}
//Generate image
var memoryStream = GenerateBlogPostMetaCardWithDescription("{ " + metaCardDescription.PostMetaTagImageDescription + " }");
//Create the image in Blob Storage
CloudBlockBlob blob = blobContainer.GetBlockBlobReference($"{metaCardDescription.PostTitle}.png");
blob.Properties.ContentType = "image/png";
blob.UploadFromStream(memoryStream);
log.LogInformation($"Post image card generation for post {metaCardDescription.PostTitle} was successful. Image was uploaded to Blob Storage");
private static MemoryStream GenerateBlogPostMetaCardWithDescription(string description)
{
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Center;
format.LineAlignment = StringAlignment.Center;
Bitmap newBitmap;
using (var bitmap = (Bitmap)LoadImageTemplate())//load the image file
{
private static async Task<PostMetaTagImage> GetBlogPostCardDescription(ILogger log)
{
PostMetaTagImage cardDescription = new PostMetaTagImage();
try
{
string content = await MakeGitHubAPICall("https://api.github.com/repos/<website-repo>/commits");
List<CommitsData> commits = JsonConvert.DeserializeObject<List<CommitsData>>(content);
CommitsData latestCommit = commits.OrderByDescending(x => x.commit.author.date).FirstOrDefault();
public static class OrderPlaceInvoiceGenerator
{
[FunctionName("OrderPlaceInvoiceGenerator")]
public static void Run([RabbitMQTrigger("medpark.orderservice/basket-service.basket_checked_out_invoice_gen", ConnectionStringSetting = "connectionStringSetting")] BasicDeliverEventArgs args,
ILogger log)
{
log.LogInformation($"Message received from RabbitMQ trigger: {message}");
}
}
public class RabbitMqExtensionConfigProvider : IExtensionConfigProvider
{
private ILogger _logger;
public RabbitMqExtensionConfigProvider(ILogger logger)
{
_logger = logger;
}
public void Initialize(ExtensionConfigContext context)
public class RabbitMqTriggerBindingProvider : ITriggerBindingProvider
{
private readonly ILogger _logger;
public RabbitMqTriggerBindingProvider(ILogger logger)
{
_logger = logger;
}
public Task<ITriggerBinding> TryCreateAsync(TriggerBindingProviderContext context)