Code

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 […]

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');

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 […]

Generic

Alfred 2 Workflow – FTPscreenshot

What it does: press the hotkey (CMD+SHIFT+8 for fullscreen or CMD+SHIFT+9 for region capture) and the workflow will take and […]

Generic

Alfred 2 Workflow – Convertor BNR *ACTUALIZAT*

ACTUALIZARE: Pentru cei care au descărcat deja workflow-ul meu, vă rog să o faceți din nou. Mulțumită lui @tbdr am […]