Skip to content

Instantly share code, notes, and snippets.

View get-ds-logs.ps1
Import-Module WebAdministration
# Variables
$logFileName = "Application"
$tempDir = "C:\temp"
$downloadDir = $tempDir + "\ds-logs\"
$programsDir = 'C:\Program Files (x86)\Dime\'
# Download event logs
$logFilePrefix = "DimeScheduler-"
View 2016-05-29-working-with-files-with-powershell_008.ps1
Get-ChildItem .\ -include bin,obj -Recurse | foreach { remove-item $_.fullname -Force -Recurse }
View azure-pipelines.yaml
# Node.js
- master
vmImage: 'ubuntu-latest'
- task: NodeTool@0
View resources-to-javascript-008.cs
public class ResourcesHelper
private readonly IStringLocalizerFactory _stringLocalizerFactory;
public ResourcesHelper(IStringLocalizerFactory stringLocalizerFactory)
_stringLocalizerFactory = stringLocalizerFactory;
public IEnumerable<LocalizedString> GetResources(string name)
View resources-to-javascript-007.cs
internal class ResourceGroup
public string Name { get; set; }
public IEnumerable<LocalizedString> Entries { get; set; }
View resources-to-javascript-006.cs
internal static class ResourceGroupExtensions
/// <summary>
/// Converts the source data to a Javascript variable
/// </summary>
/// <param name="resources">The record to convert</param>
/// <returns>A valid Javascript object</returns>
internal static string ToJavascript(this IEnumerable<ResourceGroup> resources)
StringBuilder sb = new StringBuilder();
View resources-to-javascript-005.cs
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Localization;
using System.Linq;
using System.Reflection;
namespace InjectJavascriptToWebApp
View resources-to-javascript-004.cshtml
<environment include="Development">
<resources names='new[] { "Labels" }'></resources>
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
View resources-to-javascript-001_a.cs
services.AddLocalization(options => options.ResourcesPath = "Resources");