Redux sub-reducer pattern for complex / nested data structures

I love the idea of the Redux pattern, the way all reducers are pure and predictable. I love the way they are effectively listeners that act on event notifications received from a central dispatcher, and I really like the way the whole approach simplifies the application and makes code in my Angular app’s components only …
Continue reading Redux sub-reducer pattern for complex / nested data structures

Loading an assembly from a specific path, including all sub dependencies

public static class AssemblyLoader { private static readonly ConcurrentDictionary<string, bool> AssemblyDirectories = new ConcurrentDictionary<string, bool>(); static AssemblyLoader() { AssemblyDirectories[GetExecutingAssemblyDirectory()] = true; AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly; } public static Assembly LoadWithDependencies(string assemblyPath) { AssemblyDirectories[Path.GetDirectoryName(assemblyPath)] = true; return Assembly.LoadFile(assemblyPath); } private static Assembly ResolveAssembly(object sender, ResolveEventArgs args) { string dependentAssemblyName = args.Name.Split(’,’)[0] + ".dll"; List<string> directoriesToScan = AssemblyDirectories.Keys.ToList(); …
Continue reading Loading an assembly from a specific path, including all sub dependencies

Running dotnet core xUnit tests on Visual Studio Team Services (VSTS)

1: Run dotnet restore to restore package dependencies. 2: Run dotnet build to build the binaries. 3: Run dotnet test to run the tests. Note the additional parameters –no-build to prevent a rebuild and –logger “trx;LogFileName=tests-log.trx” to ensure the test results are written to disk, 5: Use  a Publish Test Results tasks to output the …
Continue reading Running dotnet core xUnit tests on Visual Studio Team Services (VSTS)

Get list of object keys in Angular

import { PipeTransform, Pipe } from “@angular/core”;@Pipe({ name: ‘keys’ })export class KeysPipe implements PipeTransform {  transform(value, args:string[]) : any {    return Object.keys(value);  }} Then to get a list of errors for a form element you can do this <ul *ngIf=”form.get(‘userName’).invalid” class=”help-block with-errors”>   <li *ngFor=”let error of form.get(‘userName’).errors | keys”>{{ error.key }}</li></ul>

Preventing Unity3D IL2CPP from stripping your code

I was trying to get a list of a type’s constructors at runtime using reflection, so that I could create an instance of the class using dependency injection. All worked just fine until we tried to build the app for iOS. At first we were using Mono as the scripting back-end, but it seems that …
Continue reading Preventing Unity3D IL2CPP from stripping your code

Forcing a device-orientation per scene in Unity3D

Unity3D has a Screen class with an orientation property that allows you to force orientation in code, which lets you have different scenes with different orientations (useful in mini-games). this works fine for Android but crashes on iOS. The problem is the file UnityViewControllerBaseiOS.mm that gets generated during the build for iOS has an assert …
Continue reading Forcing a device-orientation per scene in Unity3D

A UI thread dispatcher for Unity3D

I’ve recently been working on implementing an IHttpService that can work outside of a MonoBehaviour and call out to web services asynchronously. Rather than providing my IHttpService.JsonPost method with callbacks I decided to have it return a Promise, the code for which I took from this Real Serious Games GitHub repository. The problem is that when you …
Continue reading A UI thread dispatcher for Unity3D

NodeJS, Web-Express, and TypeScript from scratch

Over the past year I’ve been spending my time contracting for a company in Norway. Now that project is completed it is time for me to start playing again, so I thought I’d pick up an old Node Express project. This time I intend to use TypeScript instead of Javascript. I’d also like to write …
Continue reading NodeJS, Web-Express, and TypeScript from scratch

[Solved] MVCApplication Parser Error

I have this problem because I have to develop with VS running as administrator in order to use Local IIS hosting. When files are added (or generated by compiling) I think VS was setting the owner as Administrator, which IIS then cannot read. Start a command prompt as Administrator and type in the following icacls …
Continue reading [Solved] MVCApplication Parser Error