• About
  • Privacy Policy
  • Utilities
Darchuk.NET

Typescript

Angular 2+: Binding HTML Select ngModel to a number

April 20, 2018 by Robert Leave a Comment

I hate magic things.  In programming, I mean.  I try to avoid magic strings and magic numbers as much as possible because I can barely remember the thing I typed five seconds ago, let alone something that you have to maybe type five hours from now.  So, I tend to use a lot of enums … [Read more…]

Posted in: Angular, HTML, Typescript, Web Development Tagged: Angular, HTML, JavaScript, Option, Select, Typescript, Web Development

D3.js, “this”, and TypeScript

February 23, 2018 by Robert Leave a Comment

D3.js is a super cool and very powerful library for creating some really interesting visualizations. One of the problems that I ran into recently was regarding the “this” keyword in D3 functions.  For example, in regular old javascript you would do: Which is fine.  “this” is scoped to the function, so it would point back … [Read more…]

Posted in: D3, JavaScript, Typescript, Web Development Tagged: d3, JavaScript, this, Typescript

Javascript – Combining arrays with the spread operator

February 9, 2018 by Robert Leave a Comment

Recently I had several small arrays in Javascript that I wanted to combine into one array.  It would be easy enough to write a function to accept two arrays, push the values from one into the other, and return the resulting array, but ECMAScript 6 introduced the spread operator (<—a lot more examples in this … [Read more…]

Posted in: JavaScript, Typescript Tagged: JavaScript, Spread, Typescript

RegExp

December 22, 2017 by Robert Leave a Comment

Regular expressions are powerful, but I find that they’re also incredibly annoying to use. Recently I was trying to create a parser that would try a few different regular expressions and output an object with the proper fields defined.  The input was a string separated by periods, so it was fairly easy to create the … [Read more…]

Posted in: Angular, Typescript, Web Development Tagged: RegEx, RegExp, Regular Expressions, Typescript

Unit testing error paths of Observable

December 8, 2017 by Robert 1 Comment

When you write code against an Observable, you subscribe to the result.  In the subscribe method you provide the callbacks to perform when the Observable is called back.  That means you can execute different code for success and failure. In the last post I wrote about how to mock up and test Observable<T> in Jasmine … [Read more…]

Posted in: Angular, JavaScript, Unit Testing, Web Development Tagged: JavaScript, rxjs, Typescript, unit testing

Unit Testing Angular Observable

December 1, 2017 by Robert 2 Comments

Say that you created a service that essentially wraps Angular’s HttpClient calls: And say that you called that in a component: And now you want to test the Get function to make sure that myValue is set to the value returned by the service.  If you try to create a spy on the function in … [Read more…]

Posted in: Angular, Asynchronous, Jasmine, Unit Testing Tagged: Angular, HttpClient, Jasmine, Observable, Testing, Typescript

It’s Only You — Ludum Dare 33

August 29, 2015 by Robert Leave a Comment

Ludum Dare is an over-the-weekend video game creation competition that happens three times per year in April, August, and December. Ludum Dare is latin for “To give a game.” There is no prize for winning – you simply get bragging rights. The competition is to foster creativity and encourage people to make a game. Potential … [Read more…]

Posted in: C#, Game, JavaScript, Typescript Tagged: Game, It's Only You, LDJAM, Ludum Dare, Music, Typescript
« Previous 1 2 3

Recent Posts

  • Allowing trailing JSON commas in ASP.NET Core 3
  • YADNC3JSG–Yet Another .NET Core 3.0 JSON Serializer Gotcha
  • Logging in a .NET Core 3 SignalR client
  • .NET Core 3 unit testing project sdk
  • .NET Core 3.0 Upgrade–New JSON Serializer Gotchas

Recent Comments

  1. Robert on C# Setting Socket Keep-Alive
  2. Oliver Schramm on C# Setting Socket Keep-Alive
  3. John Anderson on Waiting for a keypress asynchronously in a C# console app
  4. Ronald Garlit on .NET Core 3 unit testing project sdk
  5. Ronald Garlit on .NET Core 3 unit testing project sdk

Copyright © 2025 Darchuk.NET.

Omega WordPress Theme by ThemeHall