GitHub: images in readme.md

When I open a readme.md in GitHub, I want to see an image – that’s my use case.
As the suffix implies, this is Plain Old Markdown, so markdown syntax applies.

As an example:

![](./path-relative-to-master/mypicture.png)

You can put words inside the square brackets, but I could not see those words in a caption or tooltip, etc, in the readme.md page, so I am showing my ignorance of markdown detail, but this is good enough for me.

In fact I found this useful markdown cheat sheet, but the examples did not work for me ref the alt text, so I’m not dwelling on that anymore.

Mocha: async points in [before]

Another one under “driving me nuts”… for now just see the gist here, with a focus on the position of the [done()] call. Those more experienced than me in JavaScript may look at this and find it obvious… but it took me a long time for the penny to drop.

 

PowerShell: weird stuff when returning ArrayList

… unless you understand that a) ArrayList.Add() returns an integer, being the index of the item in the array, b) that goes onto the pipeline (unless you do something to eat it before it returns to the caller).

Here are the MSDN docs on ArrayList, where you can find the point about the Add method return value.

Here is a snippet where you can test the point in PowerShell

Google Sheets: conditional formatting across a range, based on a formula involving related cells

SheetsCondForm10

“…related cells” was the challenge.

This will do as a mock requirement:

  • As a user checking their payslips
  • I want formatting in a spreadsheet to alert me to a change in an element of my pay or deductions from month to month
  • So that I don’t have to focus on the numbers to do that

More details…

Show me if the current month’s element differs from the previous month: I don’t care if it goes up or down, just that it changes.

This is our spreadsheet before any formatting is applied. Note that the changes (basic pay, tax code, tax) are kind of small, so not that obvious.

SheetsCondForm01

First, we’ll apply the principle to cell B4 relative to cell B3, as we can see there is a change. (Assumption: the basics of conditional formatting in a spreadsheet are not new to you). Right click the B3:B4 range, and pick Conditional formatting:

SheetsCondForm02

This is the default dialog from that:

SheetsCondForm03

We don’t care about the alert colour, so we’ll leave as is. Now get to the highlighted point below which says “B4 does not equal B3”:

SheetsCondForm04

Trouble is… that is a literal reference, so when I copy it down, it will take “=B3<>B4” with it. (This is not the same as an absolute reference, i.e. $B$3 style).

We now have to introduce the technique which dynamically assesses the intended cell, and that means bringing in “indirect()” and “row()” (“col()” would be needed in a different context – this is fine for me).

Cutting to the chase, this is what we want in the custom formula:

=indirect("B"&ROW()) <> indirect("B"&ROW()-1)

The screen now appears thus, confirming that Yes, a difference has been detected:

SheetsCondForm05

We ain’t quite Done, as we want to expand the principle to all the columns and rows where we want to detect a change. For us, the columns are (say) B, C, and D.

If you change your range to look as shown here:

SheetsCondForm07SheetsCondForm08

… then this is how your grid now appears:

SheetsCondForm09

As you can see, there are some wrinkles. I’ll leave you to work those out. You know you want to 🙂

 

Mocha: getting started

I see I’ve only done Mocha in an AWS context, so let’s have a go at Mocha, and Chai as the assertion framework.

Mocha

For Mocha, you can kick off here.

Plus, the Gist here is a beautiful, simple example of asynchronous testing.

Chai

And here for Chai.

Mocha examples on GitHub
Looks pretty good here. I see they have standardised on Unexpected assertion library. If that’s the Mocha line, maybe I won’t go with Chai.

MochaUnexpected01

 

I cloned the whole thing as [git clone https://github.com/mochajs/mocha.git%5D. I then [npm install] and then [npm test]. I was interested that there was a failure in the build due to not finding a file [cairo.h], this a number of times.

MochaUnexpected03

MochaUnexpected02