Happy Numbers

I love C# but while we're trying to beat our deployment process into submission at work I'm only really writing Ruby and Powershell. So when a few, different articles about the Happy Numbers kata turned up on my twitter feed and I found myself with a large whisky and a sleeping family I thought I'd have a go.

The Happy Numbers kata is defined as

Choose a two-digit number (eg. 23), square each digit and add them together. Keep repeating this until you reach 1 or the cycle carries on in a continuous loop.

If you reach 1 then the number you started with is a “happy number”.

Can you find all the happy numbers between 1 and 100?

Transforming web.config values with Rake

I've really been enjoying using Albacore Rake instead of MSBuild at work. It's enabled us to get everyone involved (because ugh, msbuild xml) and to improve our CI/CD pipeline.

Today we were talking about reducing the number of build configurations we have… which we only have in order to support config transforms.

Static Factory Methods FTW

It is relatively common to find (or write) a line of code like this

	var thingy = new Thingy(_someDependency, false);

Reading this line a person can know this is initialising a Thingy which takes a dependency on something… and something else is false. I'm really lazy and easily distracted so I don't like to have to think about anything except the one task I'm trying to not get distracted from. Having to think about what it means that something is false provides an opportunity for me to get distracted.

Websites != CMS Platform - Wrapping Up

This post is part of a series where I'm hoping to prove to myself that building a dynamic website with NodeJS is much more fun than using a CMS platform. See the first post for an explanation of why

The code can be found on GitHub

Previous Post I've been banging this drum into the internet's echo chamber for five months now and enough is enough!

Websites != CMS Platform - Better Editable Affordance with JS for great good

This post is part of a series where I'm hoping to prove to myself that building a dynamic website with NodeJS is much more fun than using a CMS platform. See the first post for an explanation of why

The code can be found on GitHub

Previous Post In the last post a better visual affordance that a page element is editable was added. But didn't solve the problem that notifications of success or failure were obtrusive and disconnected from the edited element.

pulsing affordance

Websites != CMS Platform - Better Editable Affordance

This post is part of a series where I'm hoping to prove to myself that building a dynamic website with NodeJS is much more fun than using a CMS platform. See the first post for an explanation of why

The code can be found on GitHub

Previous Post

In the last post I wasn't happy with the visual affordance that a page element is editable.

editable sections for anonymous users

editable sections for anonymous users

Websites != CMS Platform - On Page Editing

This post is part of a series where I'm hoping to prove to myself that building a dynamic website with NodeJS is much more fun than using a CMS platform. See the first post for an explanation of why

The code can be found on GitHub

Previous Post

A.K.A. No More CMS-y Admin Section?

A traditional CMS framework or website has an admin section for logged in users. That section has a menu showing them which sections the user can edit and each section has a list of the pages they can edit and then the user can edit the text or upload images using a WYSIWYG editor.

Don't fix it if it aint broken but… but… HTML5 includes the contenteditable attribute which makes (the text of) almost any element editable.

If the admin section exists (in large part) to allow editing of content and editing of content can be completed in the page itself could this replace the admin section?

Websites != CMS Platform - Promises - part 2

This post is part of a series where I'm hoping to prove to myself that building a dynamic website with NodeJS is much more fun than using a CMS platform. See the first post for an explanation of why

The code can be found on GitHub

Previous Post

So, in the last post I worked on switching some callback code to using promises with Bluebird library but as I've not seen much promisified (definitely a word!) code I wasn't sure whether it was any good.

So I posted a question on the code review stackexchange asking for feedback.

Websites != CMS Platform - Promises

This post is part of a series where I'm hoping to prove to myself that building a dynamic website with NodeJS is much more fun than using a CMS platform. See the first post for an explanation of why

The code can be found on GitHub

Previous Post

A promise represents the eventual result of an asynchronous operation.

The basic idea is that you can swap in a promise where you would normally pass in a callback.

The primary interaction is that you call a method which returns a promise which will eventually return a result (it can immediately return the result if it's available) and you chain a call to .then() onto that method call.

The call to then is equivalent to passing in the callback function.

Clear as mud?

Websites != CMS Platform - Logging in to the site

This post is part of a series where I'm hoping to prove to myself that building a dynamic website with NodeJS is much more fun than using a CMS platform. See the first post for an explanation of why

The code can be found on GitHub

Previous Post

This was the first part of the process which felt 'hard' so where I've felt the absence of a CMS platform but it's also only the second time I've ever implemented authentication using NodeJS. And still only boiled down to a few hours work.