Visual Studio Macro: Wrap Selected Text in Tag

This simple macro allows you to wrap whatever text is selected in a tag – a feature that somehow is missing from Visual Studio 2008…

    Sub SurroundWithTag()
        Dim selectedText = DTE.ActiveDocument.Selection.Text
        Dim tag As String
        tag = InputBox("Enter tag name", "Tag", "strong")
        If (tag = "") Then
            MsgBox("No tag defined")
            ' no end tag needed as Visual Studio creates the end tag..
            DTE.ActiveDocument.Selection.Text = String.Format("<{0}>{1}", tag, selectedText)
        End If
    End Sub

Based on the answer to this question found on Stack Overflow: Macro to wrap selected text with tags in Visual Studio (which also details how you can create a macro)

jQuery Quick Tip: Extract CSS Background Image

jQuery allows you to get the background image of any element on a web page:


However, this returns it in an undesirable format: url( or url(""). With a bit of string replacement, you can get extract the URL:

function extractUrl(input)
 // remove quotes and wrapping url()
 return input.replace(/"/g,"").replace(/url(|)$/ig, "");

So now you can just do this:


Which will return the URL on its own

Rules for School Leaver’s

Got this in an email recently. It’s been on the internet for a few years, but still true now.

It can be summed up as:

Feel-good, politically correct teachings creates a generation of kids with no concept of reality and this concept sets them up for failure in the real world.

The rules:

Rule 1: Life is not fair – get used to it!

Rule 2: The world won’t care about your self-esteem. The world will expect you to accomplish something BEFORE you feel good about yourself.

Rule 3: You will NOT make $60,000 a year right out of high school. You won’t be a vice-president with a car phone until you earn both.

Rule 4: If you think your teacher is tough, wait till you get a boss.

Rule 5: Flipping burgers is not beneath your dignity. Your Grandparents had a different word for burger flipping: they called it opportunity.

Rule 6: If you mess up, it’s not your parents’ fault, so don’t whine about your mistakes, learn from them.

Rule 7: Before you were born, your parents weren’t as boring as they are now. They got that way from paying your bills, cleaning your clothes and listening to you talk about how cool you thought you were. So before you save the rain forest from the parasites of your parent’s generation, try delousing the closet in your own room.

Rule 8: Your school may have done away with winners and losers, but life HAS NOT. In some schools, they have abolished failing grades and they’ll give you as MANY TIMES as you want to get the right answer. This doesn’t bear the slightest resemblance to ANYTHING in real life.

Rule 9: Life is not divided into semesters. You don’t get summers off and very few employers are interested in helping you FIND YOURSELF. Do that on your own time.

Rule 10: Television is NOT real life. In real life people actually have to leave the coffee shop and go to jobs.

Rule 11: Be nice to nerds. Chances are you’ll end up working for one.

If you agree, pass it on.
If you can read this – Thank a teacher!