Historical Euro Rates via PHP

Just a promo post for a newly published Github repo https://github.com/mikaelz/HistoricalEuroRates

Posted in php | Tagged | Leave a comment

Batch remove Chrome’s search engines

Chrome saves a bunch of unnecessary search engines. To remove them is a real pain in the ass, because of the slowliness of the subpage

Posted in chrome, javascript | Tagged , , | Leave a comment

Open GIT repo URL with git open CLI command

Thanks to Paul Irish for the git open command.

 

Posted in cli, git | Tagged , | Leave a comment

Phinx migrate in PHP without CLI

I wanted to run Phinx‘s migrate from PHP without CLI and thanks to https://github.com/robmorgan/phinx/issues/137#issuecomment-26220408

I got it working:

The result:

ss_2017-05-18-16-37-13

Posted in php | Tagged , | Leave a comment

Composer memory limit errors

According to docs https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors I ended up aliasing composer command:

alias composer="php -d memory_limit=-1 $(which composer)"
Posted in cli, php | Tagged | Leave a comment

WooCommerce email with custom total row

To add a custom total row to woocommerce email total section just hook into woocommerce_get_order_item_totals

Customise order total rows

add_filter('woocommerce_get_order_item_totals', 'my_woocommerce_get_order_item_totals', 10, 2);
function my_woocommerce_get_order_item_totals($total_rows, $order)
{
    $new_total_rows['cart_subtotal'] = $total_rows['cart_subtotal'];

    $new_total_rows['shipping'] = array(
        'label' => 'Slovak Parcel Service:',
        'value' => wc_price(3),
    );

    $gateway = wc_get_payment_gateway_by_order($order);
    if ('cod' == $gateway->id) {
        $new_total_rows['cod'] = array(
            'label' => 'Cash on delivery:',
            'value' => wc_price(1),
        );
    }

    $new_total_rows['order_total'] = $total_rows['order_total'];

    return $new_total_rows;
}

Posted in woocommerce | Tagged , | Leave a comment

Video cutting from start to end time using ffmpeg

Sometimes I need pieces from movies to upload to YouTube for example.

It’s possible with the following nice oneliner:

ffmpeg -i IN.mp4 -ss 01:12:55 -t 35 -async 1 OUT.mp4

The solution came from http://stackoverflow.com/questions/18444194/cutting-the-videos-based-on-start-and-end-time-using-ffmpeg

Posted in linux, video | Tagged , , , | Leave a comment