Skip to content

Instantly share code, notes, and snippets.

Justin Yoo justinyoo

Block or report user

Report or block justinyoo

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
@justinyoo
justinyoo / create-dotnet-project.sh
Last active Dec 4, 2019
Tools for .NET Developers on Mac
View create-dotnet-project.sh
dotnet new sln --name MySolution
dotnet new classlib --name MyClassLib --language c#
dotnet sln add MyClassLib
@justinyoo
justinyoo / blob-trigger.cs
Created Nov 29, 2019
25 Days of Serverless
View blob-trigger.cs
[FunctionName(nameof(GiftPhotoValidationFunction))]
public static async Task Run([BlobTrigger(_containerName)] CloudBlockBlob blockBlob, ILogger log)
{
log.LogInformation("Validating Gift Image is a PNG");
if (blockBlob.Name.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
{
log.LogInformation("Confirmed PNG");
}
else
@justinyoo
justinyoo / backup-secrets.cs
Created Nov 26, 2019
Backup & Restore Key Vault Secrets via Azure Functions
View backup-secrets.cs
public async Task<List<BackupSecretResult>> BackupSecretsAsync(List<string> secrets)
{
// Declares a KeyVaultClient instance.
var azureServiceTokenProvider = new AzureServiceTokenProvider();
var kv = new KeyVaultClient(
new KeyVaultClient.AuthenticationCallback(
azureServiceTokenProvider.KeyVaultTokenCallback));
// Performs the backup and add the result into the list.
var results = new List<BackupSecretResult>();
@justinyoo
justinyoo / new-azresourcegroupdeployment.txt
Last active Nov 20, 2019
Backup & Restore Key Vault Secrets via Logic Apps
View new-azresourcegroupdeployment.txt
New-AzResourceGroupDeployment `
-Name "[DEPLOYMENT_NAME]" `
-ResourceGroupName "[RESOURCE_GROUP_NAME]"
-TemplateFile "integrationAccount.json" `
-TemplateParameterFile "integrationAccount.parameters.json" `
-Verbose
@justinyoo
justinyoo / sort-action.js
Created Nov 13, 2019
Getting the Latest Array Item with Inline Script in Logic App
View sort-action.js
"use strict";
// Assign the array value from the output of the previous action, `List Backups`.
var items = workflowContext.actions.List_Backups.outputs.body.value;
var sorted = items.sort(function (a, b) {
var dateA = a.Name.replace('.json', '');
var dateB = b.Name.replace('.json', '');
if (dateA > dateB) {
@justinyoo
justinyoo / api-connection.json
Created Nov 4, 2019
Getting the Latest Array Item in Logic App
View api-connection.json
{
...
"List_Backups": {
"type": "ApiConnection",
"runAfter": {},
"inputs": {
"method": "get",
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
@justinyoo
justinyoo / app-settings-service-bus.cs
Last active Oct 28, 2019
Handling Messages with Geo-Redundant Azure Service Bus via Azure Functions
View app-settings-service-bus.cs
public class AzureServiceBusSettings
{
public virtual Dictionary<string, string> ConnectionStrings { get; set; }
public virtual AzureServiceBusTopicSettings Topic { get; set; }
}
public class AzureServiceBusTopicSettings
{
public virtual string Name { get; set; }
@justinyoo
justinyoo / declare-blob-sink-for-schema-registry.cs
Created Oct 22, 2019
Introduction to Schema Registry for Azure Messaging Service
View declare-blob-sink-for-schema-registry.cs
// Declare the main schema registry
var mainConnectionString = "AZURE_MAIN_STORAGE_CONNECTION_STRING";
var mainBlobClient = CloudStorageAccount.Parse(mainConnectionString)
.CreateCloudBlobClient();
var mainBlobBaseUri = "AZURE_MAIN_BLOB_STORAGE_BASE_URI";
var mainSchemaContainer = "schemas";
var mainSink = new BlobStorageSchemaSink(mainBlobClient)
.WithBaseLocation(mainBlobBaseUri)
.WithContainer(mainSchemaContainer);
@justinyoo
justinyoo / fluent-validation.cs
Last active Oct 7, 2019
Many Meanings of Message Validation
View fluent-validation.cs
public class OrderItem
{
public string ItemId { get; set; }
public int Amount { get; set; }
}
public class OrderItemValidator : AbstractValidator<OrderItem>
{
public OrderItemValidator()
{
@justinyoo
justinyoo / azurite-install.sh
Last active Oct 15, 2019
Azure Storage Emulator on Azure Pipelines
View azurite-install.sh
# Install the latest preview
sudo npm install -g azurite
# Install the latest stable
sudo npm install -g azurite@2.7.1
You can’t perform that action at this time.