Skip to content

Instantly share code, notes, and snippets.

View fredgdaley2's full-sized avatar

Fred Daley fredgdaley2

View GitHub Profile
@fredgdaley2
fredgdaley2 / AzureBicepNotes.txt
Created January 10, 2023 17:32
Azure Bicep notes
Run the following command to ensure you have the latest version of Bicep:
az bicep install && az bicep upgrade
Sign into Azure
az login
Set the default subscription for all of the Azure CLI commands that you run in this session.
az account set --subscription "Concierge Subscription"
@fredgdaley2
fredgdaley2 / VueTips.txt
Created August 10, 2022 00:25
Vue blog post tips
https://www.telerik.com/blogs/understanding-vuejs-nexttick
https://www.syncfusion.com/blogs/post/top-7-javascript-object-destructuring-techniques.aspx
https://www.telerik.com/blogs/understanding-renderless-components-vue
https://www.telerik.com/blogs/dynamic-components-vue-component
https://www.telerik.com/blogs/understanding-vue-deep-css-selector
https://www.syncfusion.com/blogs/post/top-5-features-of-vue-js-devtools-to-enhance-your-development-strategies.aspx
@fredgdaley2
fredgdaley2 / WaitForFileToBeAccessibleAsync.cs
Last active April 7, 2022 00:19
Asynchronously wait for file to be accessible
private async Task<bool> WaitForFileToBeAccessible(string fileWaitingOn, int retryThreshold = 1000)
{
int numberOfRetries = 0;
while (numberOfRetries < retryThreshold)
{
try
{
using var fs = new FileStream(fileWaitingOn, FileMode.Open, FileAccess.ReadWrite, FileShare.None, 100);
numberOfRetries++;
fs.ReadByte();
@fredgdaley2
fredgdaley2 / AppsettingsCompare.cs
Created April 4, 2022 02:00
Compare appsettings.json files .Net 6
using Microsoft.Extensions.Configuration;
var originalAppSettingsPath = "appsettings.json";
var newAppsettingsPath = "newappsettings.json";
var builder = new ConfigurationBuilder().AddJsonFile(originalAppSettingsPath).Build();
var configElements = builder.GetChildren();
var cnfgPaths = new List<ConfigPaths>();
GetChildren(configElements, cnfgPaths);
@fredgdaley2
fredgdaley2 / constants.js
Created April 3, 2022 18:53
Create javascript constants
const GAME_STATES = Object.freeze({
NOT_STARTED:'Not Started',
PLAYING: 'Playing',
FINISHED: 'Finished'
})
export default GAME_STATES
@fredgdaley2
fredgdaley2 / index.html
Created October 31, 2019 00:45
Print html to pdf
<!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">
<title>Document</title>
<style>
.redhead {
@fredgdaley2
fredgdaley2 / BundleConfig.cs
Created July 20, 2019 16:21
Bundle Extension for versioning
using System.Web.Optimization;
using MyProject.Extensions;
namespace MyProject
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
@fredgdaley2
fredgdaley2 / ListView.razor
Last active August 3, 2021 02:42
Blazor Component - ListView includes ConditionalDisplay and ForEach components
@typeparam TItem
<ConditionalDisplay Show="@Render">
@HeaderTitle
<ul>
<ForEach Items="@Items" Context="item">
<ItemTemplate>
@ItemTemplate(item)
</ItemTemplate>
@fredgdaley2
fredgdaley2 / ForEach.razor
Last active October 31, 2019 23:57
Blazor Component - ForEach
@typeparam TItem
@foreach (var item in Items)
{
@ItemTemplate(item)
}
@code {
@fredgdaley2
fredgdaley2 / ConditionalDisplay.razor
Last active November 28, 2019 01:43
Blazor Component - Conditional Display
@if (Show)
{
@ChildContent
}
@code {
[Parameter] public bool Show { get; set; }
[Parameter]
public RenderFragment ChildContent { get; set; }