Skip to content

Instantly share code, notes, and snippets.

View neamtua's full-sized avatar
:octocat:
Trying to exit vim

Neamțu Andrei neamtua

:octocat:
Trying to exit vim
View GitHub Profile
@neamtua
neamtua / woocommerce_update_shipping_costs.php
Created September 8, 2016 06:13
WooCommerce: Update shipping costs on checkout using ajax
<script type="text/javascript">
/* in order to update info on your checkout page you need to trigger update_checkout function
so add this in your javascript file for your theme or plugin
*/
jQuery('body').trigger('update_checkout');
/* what this does is update the order review table but what it doesn't do is update shipping costs;
the calculate_shipping function of your shipping class will not be called again;
so if you were like me and you made a shipping method plugin and you had to change costs based on payment method then
@neamtua
neamtua / keybase.md
Created August 26, 2016 17:02
Keybase identity

Keybase proof

I hereby claim:

  • I am neamtua on github.
  • I am neamtua (https://keybase.io/neamtua) on keybase.
  • I have a public key whose fingerprint is 9312 8617 982A F7A8 781D 0680 975A 99D0 EE0A 13C3

To claim this, I am signing this object:

@neamtua
neamtua / gallery.php
Last active September 17, 2023 19:38
Image gallery generator
@neamtua
neamtua / ci_image_resize.php
Created September 10, 2013 07:39
CI: image resize
function _resize($a,$target_width=600,$target_height=600,$marker='thumb_') {
$this->load->library('image_lib');
$ret = array('poza'=>'','error'=>'');
$size = getimagesize('./uploads/'.$a['file_name']);
$a['image_width'] = $size[0];
$a['image_height'] = $size[1];
if ($a['image_width'] > $target_width || $a['image_height'] > $target_height)
{
if ($a['image_width'] > $target_width && $a['image_height'] > $target_height)
$master_dim = 'auto';