programming magic
Iterations in Less
Part of the beauty of Less and other CSS ‘compilers’ is to enable the author to automate tedious functions that normally must be coded by hand. Suppose you needed several classes that specified padding/margins: .mRight50{margin-right:50px} .mLeft50{margin-left:50px} .pRight50{padding-right:50px} .pLeft50{padding-left:50px} .mRight25{margin-right:25px} .mLeft25{margin-left:25px} .pRight25{padding-right:25px} .pLeft25{padding-left:25px} No big deal, right? It wouldn’t take that long to type in; just cut and paste a bit. …
December 11, 2012 Tuesday at 10:54 pm
Regular Expressions Roundup
Writing some Regular Expressions? Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems. —Jamie Zawinski Well, not really. There are some cases where using a Regular Expression—RegEx— instead of a heap of convoluted if statements just makes sense from both a lazy and practical standpoint. When you’re knee-deep in writing your …
September 27, 2012 Thursday at 10:14 pm
Find Something You Like and Dissect It
I’m always on the lookout for a new technique or Better Mousetrap. I admit I don’t know all that much, so I’m happy to learn. I was playing around with Wikify @ appointment.net (a nifty tool that goes through a block of text and ‘wikifies’ it–that is, links all the words it can find to relavant Wikipedia articles) when I noticed …
September 20, 2012 Thursday at 2:48 pm
Wicked Cool FizzBuzz in Perl
The FizzBuzz problem is a simple coding demonstration to write an application in any language that counts from 1 to 100: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and …
August 22, 2012 Wednesday at 9:34 pm
