kobaatsu
7/20/2015 - 7:45 AM

見た目かなりやる気が無い

見た目かなりやる気が無い

getCodeOrder = ->
  now = new Date()
  y = now.getFullYear()
  m = now.getMonth()+1
  d = now.getDate()
  h = now.getHours()
  mn = now.getMinutes()

  code = "#{y}#{("0"+m).slice(-2)}#{("0"+d).slice(-2)}#{("0"+h).slice(-2)}#{("0"+mn).slice(-2)}#{0|(Math.random()*10000)}"
  return code
createId = (length)->
  c = "abcdefghijklmnopqrstuvwxyz0123456789"
  l = c.length
  result = ""
  while result.length < length
    result += c[Math.floor(Math.random()*l)]
  return result