News for hackers. Stuff that matters.
Re:Doomsday rule: calculate the day for any date by hashmymustache on Sunday August 10, 2014 @03:04PM (#8160406)
Not sure how the doomsday works, but there's a quick way to calculate the day of week just memorizing single digit codes for months. Might be easier to grok from a small script. This is for current century (2000s) in coffeescript:

calculateDay = (year,month,day) ->

  y = (year-2000)%28
  m = [6,2,2,5,0,3,5,1,4,6,2,4][month]
  if month < 2 and y%4==0
      m-= 1
  y += y/4|0
  days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
  return days[(y+m+day)%7]
--- For years 1600s through current century here's a jsfiddle with a slightly longer method with verification: http://jsfiddle.net/9zp0zkxz/

Edit: no idea how to work spacing on comments here

Re:Doomsday rule: calculate the day for any date by ColinWright on Sunday August 10, 2014 @03:22PM (#8160447)

  > no idea how to work spacing on comments here
* Blank lines create new paragraphs,

  Blank line followed by lines with
  leading spaces create pre-formatted
  text - intended for inserting code.
Under most circumstances, asterisks around text creates italics, the exception is when the asterisk is surrounded by space.

-- https://news.ycombinator.com/formatdoc

Re:Doomsday rule: calculate the day for any date by hashmymustache on Sunday August 10, 2014 @08:55PM (#8161380)
ah, thank you
Re:Doomsday rule: calculate the day for any date by elwell on Sunday August 10, 2014 @04:03PM (#8160572)

  calculateDay = (year, month, day) ->
    y = (year - 2000) % 28
    m = [6,2,2,5,0,3,5,1,4,6,2,4][month]
    m-- if month < 2 and y % 4 is 0
    y += (y / 4) | 0
    ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][(y + m + day) % 7]