Cards Against Humanity – Black Card Generator

Recently I was at a friends house with what I thought was a complete game of CAH. Unfortunately all of my black cards had been placed inside one of the expansion card packs, which I didn’t bring.
We googled for something that would just spit out black cards so we could still play, but all we could find were images of the black cards. Maybe we didn’t look hard enough but I knew it shouldn’t be that difficult to whip up a generator using a bit of ajax and the 135 black cards I had.

So if you ever need a CAH black card generator

MySQL replace statement

How can I search and replace within MySQL/MariaDB?

UPDATE table_name
SET table_field = REPLACE(table_field, 'find this string', 'replace with this string')
WHERE table_field LIKE '%find this string%'

htaccess – Redirect while removing query parameter

The parameter being removed in this example is ‘qwerty’ with up to 5 numeric digits afterwards.

RewriteCond %{QUERY_STRING} qwerty=[0-9]{1,5} [NC]
RewriteRule (.*)$1? [R=301,L]

The question mark in the RewriteRule is what tells Apache to not include the query parameter during the rewrite.