Skip to content

Instantly share code, notes, and snippets.


Hendrik Bulens hbulens

View GitHub Profile
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");
View resources-to-javascript-001.cs
public void ConfigureServices(IServiceCollection services)
services.Configure<CookiePolicyOptions>(options =>
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
services.AddLocalization(options => options.ResourcesPath = "Resources");
You can’t perform that action at this time.