How to make WooCommerce update shipping costs on update_order_review

Been banging my head over this for a couple of days now and couldn’t find any answers until I actually […]

Gist: Single page image gallery generator in PHP

Made a single-page script to generate a gallery from pictures you have in a folder. It contains a small admin […]

Generic

How to get rid of the banner ads in Skype 6

This was bothering the hell out of me. It’s the banner that appears on top of your chat window. To […]

Javascript

Fixing “cannot call methods on button prior to initialization” when using Bootstrap

Ran into this problem today. I wanted to make a button with loading state and whenever I called $().button('loading') I […]

PHP

Remove NULL values from PHP arrays

$new_array = array_filter($old_array, 'strlen');

css

Centering an image in a box

I came across this great article about how to center vertically and horizontally an image inside a div. http://www.brunildo.org/test/img_center.html

PHP

How to strip russian characters from a string

$string = 'Этот текст на русском языке'; var_dump(preg_replace('/[\x{0410}-\x{042F}]+.*[\x{0410}-\x{042F}]+/iu', '', $string));

PHP

Securing your ajax scripts

Here’s a few tricks I’ve learnt while working on a project: 1.  Check HTTP_X_REQUESTED_WITH Referrals are tricky. They cannot be […]