Tahir Hassan's Blog

My Technical Notes

Monday, 15 December 2014

Use of Regex Replace method

I needed to replace all instances of `a.AddressLineX` with `COALESCE(a.AddressLineX, '')`. Here is the code I came up with:

A few things to note: `${1}` can be replaced with `$1`, but it is handy to remember because we might want to write a digit after the group, so we write `${1}1`, not `$11`. Secondly, in PowerShell, to escape the single quote character, we double them up, like in SQL.

Thursday, 11 December 2014

Less.css - Preventing the repetition of long selectors

In Less, we can prevent the repetition of very long selectors, by using variables.

Less.css - Media Queries

In Less, we can use variables to help us prevent repeating the same media queries.

Automatic Resizing of Font to fit in Container

In the following snippet, `.wizard-header` is the target of the automatic resizing. `.page-content` is the container that we want to constrain it to. `16` is the start font. `5` is the minimum font. (both in px).

Tuesday, 9 December 2014

IEVersionizr.js - a method of adding IE specific classes

Wednesday, 3 December 2014

GIMP: Changing Black Logo to another color

These instructions come from Changing solid black to a color in GIMP.

Solution:

  1. From the Layers window, add a new layer.
  2. Fill the layer with the color you want.
  3. Change the layer mode of the new layer to "Lighten only".

TODO: Rewrite the above instructions giving indication where "Lighten only" is.

C# - Inserting Images in an Email