Creating Unique ID's For… Anything!
There are numerous reasons you might need a unique identifier on something; you upload files with common names to the same ftp site, you use the id attribute for internal links on a blog that might display multiple posts (the chances of repeating yourself are good), you want to sign your emails with a unique, one time id for your own verification… Whatever the case, a unique id could come in handy.
The easiest thing to do is use a timestamp and a shell script can do that easily enough for us. For everyday use, the year, month, day, hour, minutes and seconds should suffice (unless you need multiple unique id’s per second). Here is how the bash script would look:
date +%y%m%d%H%M%S
Entering this string into the Terminal.app would yield a twelve digit number like this:
091027191546
The first pair of digits is the year, the second pair is the month, the third pair is the day, then the hour, minutes and seconds (all in pairs). Run this script in Terminal.app as many times as you like and you will never get the same number.
So you could enter this into your terminal every time you wanted a unique id… or you could make this shell script work for you from anywhere.
TextMate Snippet
TextMate makes running shell scripts dead easy — all you need to do is create your own snippet. To do this:
- open your Bundle editor —
Bundles > Bundle Editor > Show Bundle Editoror⌃⌥⌘B - create a new bundle (if you don’t already have your own) from the + icon
- within that bundle create a new snippet from the + icon
in the edit window, type:
`date +%y%m%d%H%M%S`- define a Tab Trigger or Key Equivalent
- leave the scope selector blank to have the snippet apply to all language types
Now you have a snippet that is accessible in any language scope you use TextMate for. This is handy if you write reference links in HTML articles, such as:
<a href="#note_091027194043">See this note</a>
<div id="note_091027194043">
This is the special note I wanted you to see.
</div>
Or for reference style links in MarkDown:
Check out our site, [seyDoggy][a_091027194631], for some
really cool tips and tricks.
[a_091027194631]: http://www.seydoggy.com/ "seyDoggy's really cool site"
Download
Download your fresh copy of “Unique ID.tmSnippet” from seyDoggy.com.
AppleScript to clipboard
Say you’re not a TextMate user but you still want a quick way to run this shell script with as little effort as possible. AppleScript makes quick work of this task with it’s do shell script functionality. We need to make an AppleScript that runs the shell script, then copies the results to the clipboard. Then we can paste that result into what ever we’re working with at the time; file renaming, email signing, etc…
Here is how the script looks:
set uniqueID to (do shell script "date +%y%m%d%H%M%S")
set the clipboard to uniqueID
display alert "\"" & uniqueID & "\"" & "Has been copied to your ¬
clipboard" giving up after 1
Download
Get your fresh copy of “UniqueID.scpt” from CodeCollector.net
TextMate Tip: Use Color Picker in All Bundles
After reading this TextMate tip this morning about using the color picker in TextMates CSS bundle, it reminded me of an article I thought I wrote once about extending this same color picker functionality to the other bundles I commonly use in TextMate (namely Property List). After a quick search here and on other blogs of mine, I was unable to find it. So I Googled it and as it turns out, I blogged about it on Flickr of all places. Knowing the information wasn’t of much use there, I thought I had better revisit this tip for the benefit of other geeks.
Use Color Picker in Other Bundles
So here is the gist of it; in the CSS bundle in TextMate you can quickly pick colors for your CSS properties. This is great, but I do a lot with hex colors in other bundles too, like the Property List, Javascript and jQuery bundles. So here is what I did…
I opened the Bundle Editor (⌃⌥⌘B), went into the CSS Bundle, found the “Insert Color…” command and made a copy of it (it’s the ++ icon at the bottom of the panel). I selected and renamed the command and changed it’s Scope Selector from “source.css” to “text, source”. This will enable color picker for just about everything. “text” will cover all of the plain text based languages like HTML, XML, Property List, Markdown, BB Code, LaTeX, etc… While “source” will cover all the programatic languages like CSS, Javascript, PHP, Ruby, etc…
Now keep in mind that this particular command is going to add the hash (#) as a prefix. This may not suite you needs for some languages so you may choose to make another “Insert Color…” command for those languages and modify the appropriate lines, then use “source.actionscript.2″, for example, as your Scope Selector.
Play around with the poosibilities and have fun.

Life As a Theme Developer
Have you ever wondered what a day in the life of a professional RapidWeaver theme developer is like? Wonder no more because I am about to tell you.
02-18-09 07:22 – started writing this which will end up being a blog post on seyDoggy.com
02-18-09 07:23 – opening up Mailplane.app to have a gander at what support has crawled in overnight.
02-18-09 07:28 – popping in the the Realmac Software forum to respond to a thread I was notified about… nothing for me to add.
02-18-09 07:40 – helped potting training daughter go to the potty.
02-18-09 07:52 – responded to an email from the seyDesign Member Group.
02-18-09 07:53 – reacted to a Twitter follow request… followed.
02-18-09 07:56 – Twittering.
02-18-09 08:02 – responding to another Realmac Software forum thread.
02-18-09 08:04 – sifting through a bunch of press releases that I subscribe to.
02-18-09 08:18 – responded to a comment on seyDoggy.com blog.
02-18-09 08:19 – moving over to the support email account now. Checking the spam box since Google seems to deem all of my real support requests as Spam.
02-18-09 08:21 – yup, 7 messages caught in the spam box.
02-18-09 08:22 – opening up Parallels to confirm one users report of an IE bug with one of my themes.
02-18-09 08:24 – realizing that their complaint has more to do with screen size than anything else. It’s not a bug, me thinks. Keep testing.
02-18-09 08:28 – just got a wrong number on the support line. “seyDoggy who? I’m trying to call my sister.”
02-18-09 08:38 – yup, IE6 issue was just the end users window size. I like that kind of support.
02-18-09 08:50 – support taking longer then I hoped. Need some tunes.
02-18-09 08:59 – support is done.
02-18-09 09:00 – opening my calendar (a Fluid.app SSB of Google Calendar) to see what’s on the plate. My calendar is my mental mapping tool.
02-18-09 09:19 – more forum posting.
02-18-09 09:20 – back to calendar, deciding how long it’s been since I invoiced this one client before deciding to do more work for them. Have to be extra cautious in todays economy, not to get into too deep with any one client.
02-18-09 09:21 – going to do some site updates (in TextMate) for said client.
02-18-09 10:27 – just answered someones questions about M Cubed Softwares Code Collector Pro.
02-18-09 10:48 – syncing client changes via Panics Transmit.
02-18-09 10:57 – hmm… forgot to update the sitemap… and all the french <title> tags… ugh
02-18-09 11:06 – sitemap updated, french <title> tags updated, re-syncing.
02-18-09 11:26 – fresh coffee, looking at my calendar… what next…
02-18-09 11:28 – checking my @bugs tags in TaskPaper to see if there are any pressing bugs I should tackle… one in seyDoggy bloop! but it’s going to have to wait until I have the time for some extensive rewriting. It’s only an issue with one plugin so it’s not really a bug as much as it’s a compatibility issue. Moving on…
02-18-09 11:33 – continuing with Med Designs Bubblegum.rwtheme update. Adding some really cool new features to it. Checking my todo list within the theme to pick up where I left off on Monday.
02-18-09 11:54 – force quitting RapidWeaver after I jammed it up with a tricky Theme.plist move.
02-18-09 12:22 – commit current set of changes to the rwtheme package go make lunch.
02-18-09 12:54 – exercise… it’s important to get away from the office chair for a bit so you don’t develop deep vein thrombosis, but getting and walking about is boring. So I exercise; 50 pushups, 25 crunches, 20 lying-on-my-back-leg-lift-thingies, 20 of the same, but lying on my side, and then again, but on my tummy. Not only is it good for preventing DVT, but it helps my core compensate for slouching at my desk for hours at a time.
02-18-09 13:17 – back to Bubblegum.rwtheme update.
02-18-09 16:04 – committed a whole whack of changes to the Bubblegum.rwtheme. Time to wonder about the house for a stretch and maybe splash some cold water on my face.
02-18-09 16:08 – scheduled in two custom jobs, one for Friday and one for Monday… sigh.
02-18-09 16:23 – feeling refreshed. Time to get back at it. But it’s time for 10 minutes of fun; time to read a chapter of jQuery in Action.
02-18-09 16:45 – Well it’s time to call it a day and go embrace the inner chef in me. I hope you’ve enjoyed peering into a day in the life of a professional RapidWeaver theme developer.
RapidWeaver's %pathto%, TextMate can help
It’s no secret that many RapidWeaver developers are quite close and help each other out quite a bit. It’s also no secret that in order to develop RapidWeaver themes you need to use some pretty powerful tools. Some of use TextMate, the most powerful one in my opinion. There are so many ways to extend TextMate’s features to streamline our workflow, one of the simplest is to edit existing bundles by tweaking their commands or snippets or making a command or snippet of your own.
So back to the RapidWeaver developers… recently, Giuseppe at Bonsai Studio shared a TextMate snippet with the other developers. A snippet that would write a very specific RapidWeaver string that we tend to use quite a bit:
<script rel="stylesheet" type="text/css | text/javascript" src="%pathto(script/filename.file)"%></script>
I jumped all over this because as you may know I am a huge TextMate nut. However, the snippet didn’t quite run the way I wanted. So I set about to make it the way that was most useful to me. The main difference being that mine would highlight the file path when activated making it an even faster shortcut for me.
But I didn’t stop there. I wanted one that would handle <link> as well. So the result is to snippets that quickly write a <script> string and <link> string that include the %pathto% syntax.
So if you are a heavy TextMate user and happen to develop RapidWeaver themes then you might be interested in these two snippets.
My top 5 web development tools
As a small web design outfit in Kitchener I have to be particular about my development workflow and the tools I use. I can’t afford to continually invest in new wonder apps that do a bit of this and a bit of that, and do this thing well but not that thing, but this other app does that thing but not… well, you get the point. So I have to really focus on what makes me money and will continue to make me money going forward. So I have compiled a list of apps that make web design and development on the Mac possible for me.
TextMate
There is text editors and then there is TextMate. Renowned for it’s unparalleled abilities to handle a seemingly limitless set of languages, TextMate makes writing ANY code fast and painless. I use TextMate for every bit of text editing that I do, XHTML, CSS, XML, PHP, SQL and javascript, just to name a few. It’s not free but you will agree that there is no other text editor that comes close to TextMate.
MAMP
If you are already a pro web designer you are already aware of the need for a live server environment to test out whatever systems you happen to be developing at the time. You also no that uploading to a remote location is time consuming and working SFTP, SSH or WEBDAV can be unstable. You best bet is to have a local server, but if that is not within your means (or know-how) then you need to look at MAMP. MAMP is a nicely bundled package of MySQL, Apache and PHP that allows you to run a web server safely on your own computer. Though Apache and PHP are already included on you Mac, they tend not be as current as those found in MAMP. MAMP also allows you to quickly change your servers from one project to another to keep your perceived root URL common across all your local web work. The best part is, the only version of MAMP you really need to get this done is free.
Safari
Don’t hate for this. I don’t mind FireFox and I think FireBug is great but to be honest I never use either one on a regular basis. Safari, on the other hand, in an indispensable tool for me. By enabling the developer features of Safari I am able to peer into the DOM for those tricky to view javascript behaviors and see what is really happening on the client side. Safari, of course, is include with your Mac operating system.
PhotoShop
What is web design without the design? There are a ton of free options out there, but lets be honest, there is no substitute for the real thing when it comes to mocking up proposed web layouts. I agree PhotoShop is outrageously priced but in the grand scheme of things, if you are getting paid for your work then the cost of this app is nothing more than a tax write-off at the end of the year.
Parallels
You can dispute me on this choice because I honestly have no experience with anything else. The work involved in getting 3 valid VM’s working for the purpose of testing 3 related and equally crappy browsers, IE6, IE7 and IE8, leaves me with no interesting in going through anything remotely similar in the near future. But my point is this, you need to have a way of testing Microsoft’s Internet Explorer, version 6, 7 and 8 and whether you do this via Parallels or VMware is of little consequence to me. It needs to get done all the same. The cost of each is comparable to the other.
If the above list is all you ever invest in for your web design and development career then you are in excellent shape.
The beauty of RapidWeaver meets the power of TextMate
As a web designer and fairly huge Mac geek I am one of those guys who gets rather passionate about certain apps and workflows, etc… Those of you who have read one or more entries on nutMac.com, a Mac workflow blog I write for on occasion, you’ll know that I am a big fan of Path Finder, Quicksilver and TextMate, three apps that rule my world. Recently, suspecting I wasn’t tapping into TextMates full potential, I purchased TextMate – Power Editing for the Mac by James Edward Gray II. Well I was correct in my suspicions, since by chapter 3 I had already learned so many more tricks that I couldn’t wait to get back into coding just to put what I had learned to the test.
One trick I had always been vaguely aware of, and apparently by name only, was the “Edit in TextMate” feature. I had looked at activating this at one time but had decided it was terribly complex for something I could just set of a Quicksilver trigger for (which I did, or so I thought). Having just skimmed over what this “Edit in TextMate” feature was, I figured this was just some short hand trick for forcing various files types and folders to open in TextMate as opposed to their default application. In fact, this is a power user feature that allows TextMate to hijack the editing fields of other apps (the search field in Google home page, or in this case, the blog post field of Blogger, my Fluid SSB app).
Here is where the little light bulb went off in my head… Could this be used in RapidWeaver? Now let me start by saying I LOVE RapidWeaver, I really do, but when it comes to HTML code editing, which I do on a continual basis, I can’t stand not having my TextMate features and functions handy. I have always found myself writing code in a dummy TextMate file, then copying and pasting it into RapidWeaver. And when I would have to make a change I would copy the code into the dummy TextMate file and so on until I was satisfied with the results.
So to make a long story short, after years of using TextMate, I finally enabled the “Edit in TextMate” feature and tried to invoke it in a RapidWeaver project and POOF! It works like a charm! Now I can place my caret in any RapidWeaver field (main content, sidebar, titles, custom fields, etc…) in RapidWeaver and type ctrl-cmd-E and edit the contents of that field with the power of TextMate.
Dropbox and Versions on the horizon
Given that it has been a month and a half since I’ve written to this blog, I feel compelled to tell you why it has been so long. I, Adam Merrifield, mild mannered web designer by day, and… er… mild manned web designer by night, have been so swamped with work that contributing to this little blog has been all but impossible. I could have jumped all over a dozen new apps that I had been given for beta testing, but sadly I had no time to test them.
There are two however, that are worth mentioning, as I really do want to try and work them into my daily flow. The one is Dropbox, which is a remote syncing type app that will “push” all updates and changes made from one computer to all other computers linked to the same account. Now from what I can tell the intent is that it be more of a storage/portal device that takes what you are working on here and sends it there so you can keep working on it when there become here… er.. or there… anyhow, you get the point. You’re working on a project at work and the boss tells you it need to be done by tomorrow so you send it through the pipes to home, work on it there, send it through the pipes back to work in time for the big presentation the next day, landing your company the BIG account and your boss loves you and gives you a raise and the keys to his Cadillac and owe it all to drop box…
But that’s not what intrigues me about Dropbox, no, what really has me interested in Dropbox is to see if it can be used as a remote backup device and what capacity is available to the user. As soon as I get the chance I will put this one to the test to see whether it’s worth getting my clients excited about a beta.
The other app for which I have been waiting to get my hands on for more than a year is Versions, a subversion client for the Mac. If you don’t know what subversion, I am not going to explain it here, but in short it eliminates the problem of multiple developers working on a single project at the same time. You don’t need an app to take advantage of the power of subversion (command-line in Terminal or TextMate will do just fine), but it does make it a tad sexier when you put a GUI to the process.
I did try Versions.app just briefly, signing up with a free beanstalk account for testing purposes, but I failed to get the connection. I will have to come back to this one in a few days.
So if you have any experience with either of these apps, feel free to leave your comments and let me know what you think.
There are geeks, then there are Geeks
How much happier could a geek like me get? Well for the first time since I started putting down my Mac thought patterns down on digital paper (this blog) I can say that I am proud of the keywords used to find nutMac. My top 25 keyword are predominantly TextMate, QuickSilver, MAMP, HTML, CSS, SQL, websearch and various combinations therein. If that is not THE most geekified set of words, I don’t know what is. The only word missing from the list is Unix!
So what does this mean? I guess I could use it as some sort of metric that what I write is important particular demographic. I mean, these keywords are an exact reflection of what I write about. These are things I have searched for myself wishing to find an article that answered my needs. Maybe my articles are answering the needs of geeks like me. That would be pretty cool if you ask me.
So if you read this blog, you must be a geek. But not any geek; you are a Mac geek and probably one that knows a little more than the average geek about OS’s, hardware, software or some form of programming. You are hardcore (if not just work with me here). So if you like what goes on here, but crave something more of an audio nature, please check out the podcast from MacBreak Tech. I have raved about them in the past and I am going to do it again now. This show is for geeks. Real geeks. Crack the case open, pull on the wires, hack it with a bash command kind of geeks.
The first time I wrote about the show, there would be only 5 or 6 comments per episode. Now they get 15 to 25 per show, and the geekier the show, the more comments! Take, for instance, the show where they turned an old G4 Power Mac into a NAS drive (a long standing request of mine). How geeky is that? It got 25 comments! You have to be a hardcore geek to understand WHY anyone would want to do this (the correct answer is “because you can”, by the way).
The number of outlets for this kind of geekery are few and far between (outside of flame bait, forum arenas where the main topics are Kirk vs. Picard ) so when a show as well put together as this one comes along, one that doesn’t cater to the ADHD, Digg skimming, tech trend surfer, it is a refreshing and very welcome change.
Thank you John, Kenji, Ben and Craig for making MacBreak Tech.
Configuring TextMate SQL to play with MAMP
I want to preface this by saying that I might be totally ass backwards in doing this but I had a need and I answered it. So before you try what I am about to tell you, be warned, if this totally obliterates your computer, project, or anything at all… it’s not my fault!
Ok, here is my needs, part 1; I run MAMP on my system to develop web projects locally. I use MAMP because it has more up to date versions of Apache, PHP and MySQL and I can update any of those on the fly at any time. It’s great that OS X has all of this pre installed (save for the MySQL), but it just isn’t very fast and I’ve always felt that by banging on the these system services I can potentially harm my system as a whole. With MAMP, I can bang on the innards of it’s services all I want and only worry about breaking that which resides in the MAMP folder.
My needs, part 2; I am a heavy, heavy TextMate user and as it happens, TextMate is a brilliant SQL editor which allows for complex queries to be written in a comfortable editor (as opposed to the very linear Terminal.app) and executed in a sexy little browser. The problem with is that TextMate presumes you will compile your MySQL server in the standard location and configuration (/usr/local/mysql/), where as MAMP puts it all in it’s own folder located in the Applications folder (/Applications/MAMP/tmp/mysql/).
What I have found is that TextMate want’s to access the socket (mysql.sock) in the /tmp/ folder (buried in the /private/ folder on the hard drive), but I know the MAMP socket is located at /Applications/MAMP/tmp/mysql/. So I thought I would try making an alias of this socket in the /tmp/ folder for TextMate to find. And it worked.
WARNING: IF THE TERMINAL SCARES YOU THEN LOOK NO FURTHER
First, open terminal, then type in the following line to create the link (this is based on the assumption that you already have a /tmp/ folder which you should):
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
Next, you want to change the owner:
sudo chown _mysql /tmp/mysql.sock
And lastly the permissions:
sudo chmod 777 /tmp/mysql.sock
Now from the SQL bundle preferences in TextMate, add your server and database info (assuming you have already created a database). Remember that by default, MAMP MySQL administration is set to user: root, password: root (yikes, you might want to change that). It would look something like this:

That’s it! Now you can freely execute SQL queries from TextMate using your MAMP MySQL engine.
Make your web apps Fluid
You might all be aware of my fetish with productivity, right? Well it’s really what this blog is all about. What I enjoy about time off, such as this recent stint we had with Christmas, is I get to fool around a bit with things that may or may not make me more productive but I just won’t know until I try. Enter Fluid! To preface where I am going with Fluid, here are some things that you have heard me go on about more than once, I am sure:
- web apps suck
- portability rules
- consolidation is king
- proprietary kind of stinks
This being said, there is more than enough contradiction in these statements to make a philosophers head spin until 2010. Yes I think web apps suck, but I do enjoy the freedom and portability they provide. I do believe that consolidation is the way to go (I can do most of my daily web design tasks using TextMate, Quicksilver and Path Finder) but I also feel that using a single browser with multiple tabs to edit some docs, post to your blog, update your calendar, Tweet your friends and watch YouTube videos is a bit much to ask.
This is where Fluid (from the developer of my favorite TextMate plugin, BlogMate by Todd Ditchendorf) comes in. Fluid allows you to create Site Specific Browsers (SSB) which essentially turns any of your favorite web apps into a native OS X apps. The benefit being that if your web app does something wonky, it doesn’t crash your browser and everything you had open at that moment, it only crashes that specific app. And with a web browser I tend to always lose focus of my sessions on particular web apps and close a multi-tabbed browser before I realize that I was in the middle of something in one of those tabs. Having a standalone app of each of those web apps prevents me from losing my place.
Here is another benefit I found; Safari, on a good day, sucks up 250 Mb of Ram… throw in a few tabs, some video, ajax, and that number begins to climb! Why, I don’t know, but when I run any of my new SSB web apps, each of their ram usage remains under 40-50 Mb respectively. So if I am on Facebook, for instance, with my SSB Facebook.app, I am pulling about 40 Mb.
One advantage to SSB apps that might only apply to guys like me; I keep my browser cache clear and my bookmarks light (I hate fumbling through bookmarks), so when social sites come and go, and web apps rise and fall, keeping tabs on the ones I like is a bit of a nuisance, typing in URLs etc… However, launching an app on my system with Quicksilver is a matter of 2 keystrokes.
So how has Fluid changed my life? There are a few web based services I have resisted, more because I couldn’t stand the thought of accessing them via my web browser. I now use Google Reader as my RSS reader, iCal has been replaced with Google Calendar, I know use Google Docs instead of MS Excel, Stikkit is more accessible to me (I love that service) and Blogger is at my finger tips (the only API BlogMate doesn’t currently support…Todd).
I am constantly working at different computer stations in different locations, I have to accept the fact that I need the portability of web apps. I also have to accept that I can’t always be on a mac (though I am 99% of the time). Web apps are a reality for me, Fluid just makes that necessity a nicer reality to live in.
