posts

Optimizing Angular $templateCache preloading with custom bundling in ASP.NET MVC

So, you're working on your Angular + MVC/Web API project, when suddenly you get irritated with your browser caching your views for the last time. That's when it hits you. This is going to happen in production. You consult the Network tab of your browser's dev tools, and see all of the extra connections that are occurring because you made nice modular directives with separate files for your templates. Now, take a breath as you find the solution to both problems right here.

Read it!

Using closures to generate multiple similar directives in Angular

Have you ever needed two Angular directives that happened to be almost identical except for some configuration variable or callback? Yes? Hot dog, have I got something for you! It's not the most unique thing ever done with a closure, but it is a slick trick that just might help you keep your code a little more DRY.

Read it!

Dynamically adding Angular directives to the DOM with $compile

One of the most useful talents of frameworks like Angular is the ability to create rich and dynamic applications. Being able to build directives that can dynamically spawn additional directives, allows for highly configurable, configuration driven pages that can take your applications to the next level. By using $compile, this becomes an easy 3 step process.

Read it!

Updating lists from defaults using LINQ and reflection

Recently, I have found myself loading a number of XML configuration files containing lists that were subject to change as our application evolved. We needed to be able to smoothly fuse the new default items into the configuration file without losing an changes already performed on items that were still valid list members. In addition, any newly invalidated list members needed to be removed. Using LINQ's Union and Intersect methods, this is actually quite easy.

Read it!

Web scraping with Nightmare.js

A year ago, web scraping was still a foreign concept to me. How could I possibly automate logging into a site, navigating to a target, and extracting the required data, especially if the site relied on JavaScript for key parts of the interaction or DOM manipulation??? Fortunately, Nightmare, a simple, straightforward Node.js wrapper around PhantomJS, takes all of the horror out of this. This post will cover how to get started with Nightmare and some tricks to get some real mileage out of it.

Read it!