Katy...ish

skip to sidebar

php is annoying

Instead of writing a meaningful post, this evening I have been fiddling with some of the code that runs this site.

Top tips, because apparently I'm rusty and forget:

Don't indent the closing line of PHP heredoc.  No matter how ugly it makes your code look.  Because if you leave any whitespace in there the whole thing breaks. CSS may cascade, but 'rules for classes' take priority over 'rules for just the element'

Anyway, I'd love to be able to brag about the tiny changes I've made to my comment form, but unfortunately when I put the code live the whole website broke.  White... continue reading »

dice clock

My original justification/inspiration for spending money on another pi plus pretty lights was this tweet - a word clock.  Very cool!

However instead of doing that, I started thinking of other (easier?) ways of displaying the time, and this is what I came up with:

Obviously a normal (cubic) die only goes up to 6, but with 9 available dots it doesn't take too much effort to add in a few more numbers.  Zero shows no lights, so midnight looks a bit boring...

The unicorn hat python library meant this was minimal effort, once I'd written out many lists of pixel co-ordinates -... continue reading »

'fun' with python and databases

In the chaos of moving house earlier this year, I decided to write a little web app to catalogue all the books and CDs I own.

Partly procrastination (packing is dull!), but mostly as an excuse to write something in Python - which we're using more of at work, and I'm nowhere near good at yet!

So I got a very basic thing mostly working using Flask, SQLAlchemy and Twitter Bootstrap.  I remember being fairly smug about it, then leaving the code in a horrible disorganised mess because I actually did have better things to do (such as packing all the books... continue reading »

popup overkill!

I love broken websites :)

I've ended up on this particular site before (it's some kind of coding tutorial site, which I won't link to for obvious popuppy reasons). Last time it stopped at 359.

Today, however, it's even more broken.  Whenever I move the mouse it tries to spawn a load more popups.  And fails.  But keeps trying anyway, even though it's never going to win.  That number is now up to 3015.

Anyway, I found the bit of javascript that creates this mess.  The 'interesting' bit can be simplified to this:

if (!popupdone) {
    window.onclick = popup();
    window.onmousemove =... continue reading »