Writing Macros with Vim
2013-02-11

First, let’s start with a Javascript function:

function foo(hello, world,
             how, are,
             you) {
}

Now let’s convert that to the following:

function foo(parameters) {
    var hello = parameters.hello;
    var world = parameters.world;
    var how = parameters.how;
    var are = parameters.are;
    var you = parameters.you;
}

Here are the macros I used to do this:

let @r='di(iparameters^[/\{^M2o^[kpg`[v`]Jgv:s/\s//g^M0:try|exe "norm! @q"|endtry^MA;^[V:s/,/;\r/g^Mv``='
let @q='ywivar ^[pa = parameters.^[f,^[l@q'
Read on...
Love Affair with Vim
2013-02-10

It wasn’t too long ago when I was a full-time C# developer and my environment was Visual Studio eight hours a day. Then, I became a web developer over night cold turkey writing Javascript and CSS. It’s one of the benefits of working for a consulting company.

You might think what does that have to do with the title of this post? Well, originally my plan was to write a blog post contrasting on the differences between Javascript and C#, as well as the development environments and deployment platforms. But really, what I really wanted to write about was Vim.

Moving from Visual Studio to Vim was a progression through different editors and environments. The first thing I used to write Javascript was Webstorm. Over time I realized that you didn’t really need an IDE to write Javascript/CSS. Then, I used Sublime Text for a little bit. But ultimately, I settled on Vim, and stayed there.

My stubbornness turned out to be beneficial when I was learning Vim because the first month was absolutely painful. I remapped all of my arrows keys to do nothing to force myself to use hjkl. Eventually I got the hang of it, and now I definitely have the muscle memory that makes me much more productive when editing (and reading) text.

Read on...
SnoopShell: Evolution

It’s been a while since I last announced SnoopShell, where I took some PowerShell and injected that into Snoop. Well, I didn’t stop there! I decided to continue working on it and adding more useful features. Well, a bunch of things have changed. For one, it’s no longer targeted at .NET 4 and PS v3 anymore (and you’ll soon know why). Second, there’s a bunch of new features! Automatic Profile Loading Upon startup, the shell will look for a couple well known locations and automatically dot-source them to load them into the current session. Read on...
SnoopShell: The marriage of Snoop WPF and PowerShell
2012-07-01

I was given the opportunity to review a couple chapters of the excellent book PowerShell for Developers, written by my colleague Doug Finke.  One of the concepts in the book was embedding a PowerShell console into your application.  This idea is ingenious and we added this feature to our client’s software, and so far it has increased our productivity and opened the doors to many possibilities. So what’s so cool about embedding a shell into your application?  Well, for starters, one of the immediate advantages is that it gives you the opportunity to test your application at run time.  If you are implementing the MVVM pattern then basically anything you can see in the UI is bound to some property in your view model.  What if you could expose an instance of your view model to the PowerShell console?  Yes, you would be able to interact with it directly, change values, and property change notification will kick in and update the UI. Read on...
N2N: .NET 2 Node: Part 1
2012-06-08

Let’s get some actual coding done. If you want some basic prologue, check out the first part of my series here. Anywho, let’s get to the meat of what we’re trying to accomplish. I will start with the typical C# class you would write, do the same in Javascript, and then again in C#, but using the style of Javascript using closures. Here’s the use case: Handle a web request Check the MongoDB database to see if an entry exists and return it if available. Read on...