Friday, May 29, 2009

file timestamp in RFC-2822 format

Creating an RSS feed from a script was pretty straight forward, but I ran into some nuisance getting the file timestamps in the right format:

element pubDate: Schemas validity error : Element 'pubDate': [facet 'pattern'] The value 'Thu May 28 22:53:18 EDT 2009' is not accepted by the pattern '(((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)), *)?\d\d? +((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec)) +\d\d(\d\d)? +\d\d:\d\d(:\d\d)? +(([+\-]?\d\d\d\d)|(UT)|(GMT)|(EST)|(EDT)|(CST)|(CDT)|(MST)|(MDT)|(PST)|(PDT)|\w)'.

element lastBuildDate: Schemas validity error : Element 'lastBuildDate': 'Thu May 28 22:53:18 EDT 2009' is not a valid value of the atomic type 'Rfc822FormatDate'.

That's the output of validation from xmllint and the XSD I have... if it's "RFC 822", "RFC 2822", doesn't really matter that much to me...

I finally got ls to produce this output format:

% ls -l myfile --time-style=+'%a, %d %b %Y %T %z' | cut -f6-11 -d' '

The date command has a nice flag (-R) that will print in this format too:

% date -R ; date +'%a, %d %b %Y %T %z'
Fri, 29 May 2009 10:14:53 -0400
Fri, 29 May 2009 10:14:53 -0400

Makes me wish we could just use %s... :-P

Wednesday, May 27, 2009

css sprites for js games

The other day, I started to look at css sprites again.

Imagemagicks' montage command is a groovy way to concatenation images together:

montage  ???1.png   -tile 1x -geometry +0+0 -background none last1.png

Along with some js shenanigans, I was able to write a small bejeweled-like puzzle game.

It's pretty neato! Give it a go!!