Archives
Admin / Logout

Adam Merrifield

a picture of me
I am a web designer, theme designer, professional photographer and internet personality. I make many pretty things and I write a lot of content for the internet.

I am one of those guys that, because of the industry I am in, need to be connected at all times. At any given moment you'll find me posting on a forum, updating with twitter, Digging things worthy of attention, uploading pictures, or tagging cool sites.

here i am

seyDoggy Systems:
This is home base, the corporate headquarters, the hub, if you will, seyDoggy.com.

seyDesign news:
these are the RapidWeaver related posts that originally appear in the seyDesign.com blog

Uploads from seyDoggy:
these are the pictures that I upload to flickr

Merrifield Photography:
as a professional photographer I my camera ready at Merrifield-Photography.com.

delicious.com/seydoggy:
these are the websites I want to share or revisit later on. I just tag them on delicious.com.

what i am

I am the owner and operator of seyDoggy Systems, a small theme, code and design outfit based in Kitchener, Ontario, Canada. We primarily develop web based technologies but have begun to dabble in the desktop realm.

what i do

I code like a fool. I design like a fool. I am happiest when I can split my time between the two (though I tire of Photoshop faster then I do TextMate or Terminal), and somehow I have managed to etch out a living doing so.

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 Snippet for Unique ID 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 Editor or ⌃⌥⌘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

UniqueID AppleScript for creating unique id'sSay 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

[tags]applescript,shell,script,textmate,snippet,terminal,unique id[/tags]

Comments (1) | Trackback

One Response to “Creating Unique ID's For… Anything!”

  1. Rob Jones Says:

    Or

    https://www.grc.com/ppp.htm

    Or

    https://www.grc.com/passwords.htm

Powered by RapidWeaver, WP-Blog and WordPress 3.3.1