February 2, 2016

I finally decided that I would like to have markdown rendering for my stinky little custom blog engine.

This article is my first one in markdown. The first guinea pig is an article about supporting markdown!

Anyways, it was incredibly easy to do.

The NuGet Package

I installed the CommonMark.NET nuget package into my project.

Then I put in a coalesce operator to grab the content and process the markdown if the html content doesn't already exist.

The Code

    public string GetBlogContent(string name)
        var metadatum = GetOrderedBlogMetadata();
        var metadata = metadatum.Single(i => i.Name == name);
        var blogDirectory = FilePath("~/blogs/" + metadata.Published.Year + "/");
        var potentialEntry = blogDirectory + "\\" + name;
        var content = 
            ?? GetMarkdownContent(potentialEntry);
        return content;
    private static string GetHtmlContent(string pathWithoutExtension)
        var filePath = pathWithoutExtension + ".html";
        if (File.Exists(filePath))
            return File.ReadAllText(filePath);
        return null;
    private static string GetMarkdownContent(string pathWithoutExtension)
        var filePath = pathWithoutExtension + ".md";
        if (File.Exists(filePath))
            var markdown = File.ReadAllText(filePath);
            var html = CommonMark.CommonMarkConverter.Convert(markdown);
            return html;
        return null;

Check it out

This is the github repository for the CommonMark.NET project.

See? Easy stuff! Until next time, be well!


December 31, 2015

I really thought about avoiding the New Year resolution stuff altogether, but it's just too ripe not to post.

I've noticed that over the past year I have gained a deeper appreciation for cliche and bad jokes. This may or may not have something to do with this being my first full year as a father. I am really focusing on building my repertoire of dad jokes.

Well then I suppose I should get started.

In no particular order, here are my ambitions:

Run Forest, Run

I am going to try damn hard to make sure I run minimally 15 miles per week, all year. I always feel great after I have gone for a nice run and yet I never consistently find the time to do so. Consistency is king.

Make my guitar gently weep, and rock

My lovely wife bought me a beautiful acoustic epiphone guitar last year for my birthday and I have been picking up a little bit here and there. I still have my old start guitar from high school. It's a black electric Les Paul.

I love music and I love the creative process. The other day I was following my daughter around the house just strumming chords. She was bouncing up and down and bobbing her head to the music. It felt really good to have an appreciative audience. I want to get a lot better after seeing that.

Capture Buffalo

I am from Buffalo, New York; a very under-rated and under-sold city. It is cheap to live, the people are good, the food is good and there are some really great sights. My wife and I bought a nice camera on our honeymoon a couple years back. I want to make use of it and start hunting for great shots so I can show off my city with my own perspective.

Become a Concurrency Wizard

Asynchronous programming is a very different beast from classical synchronous programming. The first order of business is to read through and study the Concurrency in C# Cookbook by Stephen Cleary.

I'd love to pick up Erlang or Elixir and write a pet project as well. Erlang as a language solved many of the problems that Enterprise Service Bus frameworks have solved for other languages. They solve them in very similar fashion as well. Many of the functional aspects of languages like Erlang have been steadily creeping into C#. I'm determined to be awesome at it.

Run a Tough Mudder

I was spurred to do a tough mudder by one of my co-workers. My co-workers seem to be in ridiculously good shape, so I suppose I should shape up as well.

Write, write, write

I really picked up the pace in terms of writing in 2015 as compared to all previous years. I dropped the ball on getting any personal projects done as well, but I'll give myself the excuse of a baby. I want 2016 to be even more consistent. As I said earlier, consistency is king. You build castles one brick at a time.

Waste less time

I would like to reduce all of the time sinks that don't actually benefit me. Mindlessly surfing social networks would be one of those things.

Give my salutations to yoga

I have been doing yoga for a several years now and rather enjoy it. My lovely other half is immersing herself in a nine month class to become a yogi. She has also taken on blogging which you can see here. I think it's about time I take it more seriously and as always, consistency is king. I'll really need to build a habit if I have any hope of building a practice.

So much more...

There is a lot more that I want to do next year. I will take it day by day and work to establish the habits that will help me reach my goals. I also wish you the very best in your goals for the next year.

Until next time, cheers and happy new year. Beer!