Posts tagged code

Adventures in code: PHP unit testing

If you want to make a PHP package available that works on versions of PHP from 5.3 to 8.0, testing is a giant pain. There are versions of phpunit that work for each, but none that works for all. Additionally, the basic class names changed at some point in the past. Getting all of this to run on Travis, including running code coverage (but only once for each build!) was a complex series of trials, but I finally figured out the correct .travis.yml incantation, along with a magic test wrapper for aliasing classes

Idea Instructions

Software algorithms as Ikea instruction manuals.

This review of Doom 3's source release is full of tons of interesting stuff, even for non-graphics programmers. [via waferbaby]

Javelin JS is full of interesting little things - always fun to find out what compormises other teams make to allow their particular development model to scale. The css classes vs sigils part makes a lot of sense.

31st March, 7:46 pm

rev dan catt has written up a nice piece on image processing for backgrounds. a really nice effect

29th March, 2:41 pm

the macpaint and quickdraw source is available on the computer history museum site

8th September, 11:10 am

lots of good projects coming out of node.js right now - Uglify JS is a JS minifier based on a JS AST parser and tree walker. Could do some neat things with that.

8th February, 12:37 am

learning javascript oddities from wikipedia: using !! for normalization and the return from || and &&. nice

4th April, 12:15 pm

kellan points out this interesting old TPJ article on problems with localization and gettext. the solution isn't really any good, but the problem is real

28th November, 2:52 pm

a new version of the php rfc (2)822 parser is now out, fixing a nasty bug that allowed extra periods almost anywhere in the address. oops

27th September, 11:22 am

a nice summary of some js oddities that can be used for building exploits against various filtering systems

26th August, 12:29 pm

ohloh has some interesting views of open source projects - the committer sparklines are especially nice. like a much more polished version of a tool we use internally.

14th August, 3:06 pm

bookmarking for a later - fb code leaks

19th June, 4:27 pm

mozilla are talking about some nice changes coming up in JavaScript 1.7 (starting with the next beta of ff2)

26th March, 1:43 pm

get it while it's hot - the perl color ascii art library

14th October, 5:01 pm

and i've also updated lib_filter to handle single quoted attributes.

14th October, 5:00 pm

i've coded an experimental version of an RFC 2822 address parser to update the RFC 822 version.

23rd September, 5:37 pm

a c boardgame. sooooo awesome

8th August, 8:47 pm

rate my code is awesome - thanks to salti for finding that

21st March, 10:11 pm

and here's that code in php for your enjoyment.

21st March, 9:56 pm

so easter is in march this year. the 'ecclesiastical' rules for calculating the date of easter sunday are: 1, easter falls on the first sunday following the first ecclesiastical full moon that occurs on or after the day of the vernal equinox. 2, this particular ecclesiastical full moon is the 14th day of a tabular lunation (new moon). 3, the vernal equinox is fixed as march 21. this page has more information and a code sample for calculating the date for any given year.

1st February, 6:23 pm

a new release of lib_filter (only 2 months late) to avoid the br tag being removed when the b tag should be (bad regexp - no cookie for you!).

9th November, 2:51 pm

my newest solver for roadblocks can handle one-ways and teleporters. seems to be able to cope with advanced levels easily.

5th November, 3:19 pm

[roadblocks]( ) is pretty fun, but trying to [build a solver]( is more fun. patches to support one ways and teleporters are welcomed (you'd need to extend the find_stop_*) functions to return an x,y pair for the teleporters. one ways are easy - just add to the blocks list for each direction). :)

14th October, 9:27 am

Inline::Parrot is now in CPAN. i suspect i'll be installing that later today.

13th October, 10:27 am

a nice faq answer about portable single character io. in a nutshell: no. of course, parrot will solve this for us by making everything seem portable.

13th October, 12:58 am

the poignant guide to ruby now has 5 completed chapters (with the sixth slated to come this christmas). it's really really good - both funny and informative.

13th October, 12:53 am

a question i've had before: "the x argument is a unix timestamp, but in what timezone? UTC?". unix timestamps are always UTC, since that's part of their definition.

11th October, 10:37 pm

the newly launched php wtf seem to be struggling for content - maybe there's not as many bad php programmers as one would imagine, or (as i find that hard to believe), the people running the site are finding bad code tough to spot ;)

11th October, 6:50 pm

the flickr mt plugin is pretty awesome, using not only Flickr::API, but also my XML::Parser::Lite::Tree and XPath modules. code resuse strikes again!

27th September, 9:56 am

sean o'rourke points out a nice way to get a perl shell. now why isn't there a Perl::Shell module to do the same thing without all the line noise? a CPAN-esque "perl -MPerl -e shell" would be nice.

24th September, 10:17 am

a french compsci teacher is using parrot on their vm course.

20th September, 6:13 pm

a vaguely interesting perl5 oo syntax filter module (though no standard build/install process, which sucks ass). i prefer luke's Class::Closure.

13th September, 5:24 pm

at least someone took my comments about PEAR's failing to heart.

9th September, 10:05 am

scary goings on in th p6i world - jospeh ryan explains how to inline prolog in perl 6 using macros and the cross-language eval statement.

8th September, 10:46 am

very useful - a list of which c functions are required in each standard (c89, c99, posix, etc).

6th September, 7:55 pm

oooh. yoz has released a cool hack for delicious - tag auto-completion.

1st September, 5:02 pm

a new perl module: XML::Parser::Lite::Tree::XPath . my first foray into xpath backends. docs are here. should reach cpan later today.

24th August, 11:11 am

natural docs looks really good - like javadoc but much richer and more forgiving. also makes for very readable unprocessed docs. nice.

20th August, 1:58 pm

steve fink is documenting his quest to write a regexp compiler in parrot. the three days logged so far make for interesting reading.

19th August, 2:57 pm

was reminded of channel9 again today. looks like pep designed it, but full of geniuses. from microsoft. no, seriously.

18th August, 1:26 pm

there's a discussion happening on p61 at the moment about multimethod dispatch on return continuations. this sounds like pretty crazy at first, with fungeoid implications, but could lead to some very nice debugging hook oppertunities.

18th August, 12:11 pm

a nice collection of efficiency quotes. two of those adorn the walls in the office.

11th August, 5:26 pm

what. the. fuck. i did a "pear upgrade-all" and it first failed because of dependencies. fair enough - stupid that it didn;t automatically install the dependency, but forgivable. but then once finished, pear was broken because it used php 4.2.0 only features. how fucking stupid is that? the people in charge or pear are braindead idiots.

11th August, 11:19 am

bookmarked for later - the rex parser with a javascript version of the regexp.

9th August, 9:11 pm

six apart is now taking signups for MT 3.1 beta testing. might be interesting. might not.

9th August, 4:17 pm

bookmarked for later - itunes sdks for osx and windows

3rd August, 4:39 pm

a world of sql-related headaches today. while searching for an answer, i came across this nice explanation of joins in mysql - detailing multiple left joins, which is handy stuff.

2nd August, 10:51 pm

span looks to be the first fully featured language built on the parrot vm, and so marks a big milestone in parrot's evolution. leo's python work is coming along too, with an AST generator posted this weekend. parrot is getting closer to the elusive 1.0

30th July, 3:57 pm

a live-journal-type teen-angst-girl started a use perl; jounral, thinking it was a general journal site. funny stuff

29th July, 9:35 pm

leonard linked to a nice short guide to lex and yacc. i'm working on a new language right now, using perl and P:RD. maybe lex and yacc in the future if i get adventurous.

28th July, 7:01 pm

flashkit is a constant source of despair for me. when i come up against some dumb problem in flash, i sometimes eventually post in the flashkit forums. to date, i've always recieved an entirely unhelpful solution, and usually by the same user, which doesn't fit the question at all and assumes i'm making a really basic mistake. forums with actually knowlegeable people (like ubbdev in the days of old) are a huge asset for a product's company.

26th July, 4:44 pm

further investigation of the if-modified-since problem with apache and php appears to show that it's a bug in apache 2 and the php filter plugin. stupid stupid stupid. it can be worked around with an apache directive, although that also stops php from recieving the i-m-s header, so you can't handle the 304 response manually.

Recommended porn resources by Cal, HD Porno izle and bedava porno izle finally Free Porn Tube for amazing movies.

26th July, 2:32 pm

the wikipedia page on surreal numebrs makes for interesting reading.

23rd July, 1:53 am

six-apart announce the winners of their mt-plugin contest. they should at least by slightly fucking embarrassed of the winner, since it basically patches a big problem in mt. i didn't win any of the six prizes, though all three of my plugins were in the shortlist of thirty (i know some judges ;), so 10% of the shortlist was my work. not so bad.

22nd July, 7:24 pm

hammond's webkit2png is really fucking awesome. time to fire up the ibook and get grabbing.

21st July, 4:18 pm

webpac is incorporating my google search-term highlighter in their distribution. i don't quite understand what it does (very text-heavy site) but they seem nice enough. yay for open source and code reuse.

19th July, 4:15 pm

stupid manila, part 2. in addition to not supporting the full blogger or metaweblog apis, it looks like they have escaping issues with the methods they do support :(

19th July, 3:18 pm

urgh. stupid userland/winer/manila. turns out that manila doesn't support the revised metaweblogapi spec, which is hard to find so no big suprise. but, err, userland created the spec. they also don't fully support the blogger v1 api. a developer tells me that you need to send the full url of your blog as the blog id to the *.newPost method - is this a userland construct or is it standard practice? crazy.

19th July, 1:47 pm

the ever-lucid MJD has some advice for newbies in this short video.

14th July, 10:17 pm

stupid stupid pear doesn't have an atom parser yet (and wont for ages - their standards and approval process greatly discourage people writing for it - there's no way i ever will :/) so i wrote one with the same interface as XML::RSS, for drop in replacement (it's going to be used in an upcoming aggregator project).

14th July, 10:15 pm

check out my rtf tokeniser in perl which i wrote many years ago and just remembered about (although we now have RTF::Tokenizer on cpan which didn't exist when i wrote my tokenizer).


This is the personal website of Cal Henderson, Slack co-founder & CTO.

I give occasional talks, write code and sometimes articles.

» About Cal

Recent Tags

books cheese code covid doge emoji food games havana ibm japan language maps memes minecraft php programming reading regex slack technology toast via-matts wiring

Popular Tags

apple awesome bacon code coding comics design flickr food games javascript lego maps movie music perl php programming software tech tv video visualization web


2024: Jan Feb Mar Apr May
2023: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2022: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2021: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2020: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2019: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2018: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2017: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2016: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2015: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2014: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2013: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2012: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2011: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2010: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2009: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2008: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2007: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2006: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2005: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2004: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2003: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2002: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2001: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2000: Jun Jul Aug Sep Oct Nov Dec