Usually when I run into blocks (like when I was writing a very light weight yet powerful, spelling-tolerant javascript search engine) I would go on a walk for about 15-20 minutes. If that still didn't work (which most of the time it did), I consulted my boss and/or google. If he had no idea how to put my ideas to paper (or google for that matter), I would sit upside-down in my office chair for about 5-10 minutes (that never helped, but it sure did pass 5-10 minutes and made my methodology for programming appear very foreign/entertaining for my co-workers). Then the weekend would come, and I would spend 2 days away from a computer and relaxing. This always put my head back in the game.