If you use TextMate when you’re coding for the web you’ll probably have at least tried out Jim Jeffer’s CSS Bundle, which was inspired by an article by Jina Bolton. If not check it out!
When I first downloaded it I was impressed but not exactly blown away as the snippets don’t really leverage the true power of TextMate’s bundle system. I had to get to work to make things a lot smoother.
/* ${1:Working Title} Updated: ${2:`Date +'%a'`} ${3:`date +'%d/%m/%Y'`} ${4:`date +'%H:%M:%S %Z (%z)'`} Author: ${5:`dscl . -read /Users/$USER RealName | awk 'NR==2 { sub(/^[ \t]+/, ""); print }'`} ----------------------------------------------------*/$0
I modified the “comment: updated” snippet to automatically populate the Updated timestamp for us and added a dscl command to get the RealName associated with the current user’s shortname.
The date timestamp will appear in the format “Mon 23/04/1984 12:01:21 GMT (+0000).” I’m using this format as I’m British and it’s makes sense to me. If you’re American you could switch the “%d” and “%m” around to get “MM/DD/YYYY.” Alternatively you could just replace “date +’%d/%m/%Y’” with “date +’%D’” to have a date formatted according to your computer’s default date format. For more all the possible options available when formatting dates using the date command check out WikiPedia’s date article.
I also amended the “comment: declare” snippet similarly so my RealName would be added automatically to the snippet. To do this you only need to replace “${4:Your Name}” on the “Author:” line with…
${4:`dscl . -read /Users/$USER RealName | awk 'NR==2 { sub(/^[ \t]+/, ""); print }'`}
Or just replace the whole snippet with my amended version below.
/* Theme Name: ${1:Name} Theme URI: ${2:URL} Description: ${3:a-brief-description} Author: ${4:`dscl . -read /Users/$USER RealName | awk 'NR==2 { sub(/^[ \t]+/, ""); print }'`} Author URI: ${5:your-URI} Template: ${6:use-this-to-define-a-parent-theme--optional} Version: ${7:a-number--optional} . ${8:General comments/License Statement if any.} . */$0








Jim Jeffers
July 31, 2008 at 7:10 pm
Thanks for taking the time to write some advanced snippets! I’m going to update the bundle with the revisions you’ve done tonight. Due credit will be given. Thanks for taking the time to do this!
James
July 31, 2008 at 8:46 pm
@Jim Jeffers: You’re welcome. It was a pleasure. Thanks for your work on the bundle to start with Jim!