Skip to main content

Posts

Showing posts with the label tips

CSS table tip - right-aligned column

Just a quick tip, it's been a long time! I've been sick and busy, which is definitely not a good combination... Making the first column right-aligned Suppose you need to make the contents of the first column right-aligned. An easy way to do this (assuming you have a special class/id for the table) is to use the first-child selector: table.mytable tr td:first-child { text-align: right; }

Another VI tip - using macros, an example

God I love VI. Well, actually, vim but whatever. Here's another reason why. Suppose you need to perform some repetitive task over and over, such as updating the copyright date in the footer of a static website. (Yes, yes I know you could do a javascript thing or whatever, just bear with me.) Of course you could just search and replace in some text editor, changing "2007" to "2008" (if you're stupid) - and you'll end up with a bunch of incorrect dates being changed, most likely. What you need to do is only change that date at the bottom. And suppose that because of the formatting, you can't use the "Copy" part of the string in a search replace - perhaps some of the pages use "©", some spell out "Copyright" etc. This is where vi macros come in handy. A macro in vi is exactly what you expect, it records your actions and allows you to play them back. To start recording, press q followed by a character to use to "stor...