Friday Links 0.0.10 - PowerShell, RazorEngine, Javascript Snippets

This is based on an email I send my .NET team at work

Happy rainy Friday,

This week I have a mix of things I think are interesting and worth knowing about.

Effective Windows PowerShell (free e-book)

This week Microsoft open-sourced PowerShell and added support for running it on non windows environments like Mac and Linux.

I’ve been studiously avoiding learning PowerShell. I’m already pretty familiar with BASH and use Cygwin extensively. But my custom BASH scripts are not portable to other Windows developers on the team, so I can’t check them in to project source code. They also lack a full integration with Windows internals for scripting IIS or .NET technologies.

So I’ve started investing some time in learning the basics of PowerShell. With more of our clients wanting to move their infrastructure to Azure, us knowing enough scripting to provision and configure their environments automatically will provide a ton of value for them. PowerShell is worth the time investment.

This book is a really helpful introduction and shows a lot of practical tips and tricks for creating portable, flexible, and robust PowerShell scripts.

There will be more to come on this topic.


RazorEngine provides programmatic access to the Razor templating engine outside of ASP.NET MVC. It allows you to write and render CSHTML markup from your own sources.

string template = "Hello @Model.Name, welcome to RazorEngine!";
var result =
Engine.Razor.RunCompile(template, "templateKey", null, new { Name = "World" });

Using the engine outside of ASP.NET request life-cycle could support a lot of useful scenarios:

  • Store razor markup in a database as part of a CMS or other system to allow administrators to customize page or email markup
  • Render HTML emails from a WebJob without needing to make a web request to the main site to get the content, or doing hacky controller actions that render a View as a string
  • Static website generation

Javascript Code Snippets in Chrome Developer Tools

Did you know about Chrome’s Javascript snippets tool? It lets you write and test little snippets of Javascript right in the browser.

The dev tool console is useful as a REPL, but sometimes you want to write a longer function to test and cramming it all into one line is annoying. You could write a js file in Notepad and play with it in Node, but that’s clunky. And the Snippets tool in Chrome supports the debugger, so you can figure out if the snippet works they way you want really easily.