FWIW, here is the code to exactly match couchdb.

UUID = -> '0' + (new Date().getTime() * 1e3).toString(16) +
Math.floor(Math.random() * 1e18).toString(16)


On Mon, Aug 6, 2012 at 3:43 PM, Rick Waldron <[email protected]> wrote:

> On Mon, Aug 6, 2012 at 6:28 PM, Mark Hahn <[email protected]> wrote:
>
>> That isn't a hack.  It is almost a copy of what couchdb offers.  I use it
>> all the time.
>>
>
> One is an IETF (RFC) and the other isn't.
>
> http://www.ietf.org/rfc/rfc4122.txt
>
>
>>
>> On Mon, Aug 6, 2012 at 2:17 PM, Ted Young <[email protected]> wrote:
>>
>>> Thanks for the feedback, glad to know I found the defacto solution.
>>>  Tim, that's funny, your hack is more or less what I started with, but I
>>> became suspicious that it was too easy somehow.  Maybe I'll switch back to
>>> that if file-size/performance becomes an issue (which it won't).
>>>
>>>   Ted
>>>
>>> On Aug 6, 2012, at 8:27 PM, Tim Caswell <[email protected]> wrote:
>>>
>>> Depending on how strict your requirements are, I often just use:
>>>
>>>  Date.now.toString(36) + "-" + (Math.random() * 0x10000000).toString(36)
>>>
>>> Date.now is unique every ms and Math.random has a keyspace of 2^32, so
>>> collisions are statistically impossible in most practical
>>> applications.
>>>
>>>
>>> On Mon, Aug 6, 2012 at 1:01 PM, Rick Waldron <[email protected]>
>>> wrote:
>>>
>>>
>>> On Monday, August 6, 2012 at 1:38 PM, Martin Cooper wrote:
>>>
>>> On Mon, Aug 6, 2012 at 10:28 AM, Ted Young <[email protected]>
>>> wrote:
>>>
>>> Hey y'all,
>>>
>>> So, I have a need for global unique id's. Googling about, I've found the
>>> following implementations that seem decent:
>>>
>>> https://github.com/broofa/node-uuid
>>>
>>>
>>> FWIW, this is the package that npm uses.
>>>
>>> +1
>>>
>>> I've been using Robert Keiffer's impl in projects since before it was
>>> even
>>> on npm—I consider it a "go to"
>>>
>>> Rick
>>>
>>>
>>> --
>>> Martin Cooper
>>>
>>>
>>> https://gist.github.com/1308368
>>>
>>> Not really sure why I would pick one over the other (besides file size),
>>> or
>>> if there are any js-specific issues I should be aware of. Any advice?
>>>
>>> Cheers,
>>>
>>> Ted
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>>
>>>   --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>
>>  --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to