Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Trying to exit vim

Neamtu Andrei neamtua

:octocat:
Trying to exit vim
View GitHub Profile
@neamtua
neamtua / woocommerce_update_shipping_costs.php
Created Sep 8, 2016
WooCommerce: Update shipping costs on checkout using ajax
View woocommerce_update_shipping_costs.php
<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 Aug 26, 2016
Keybase identity
View keybase.md

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 Aug 18, 2017
Image gallery generator
View gallery.php
View ci_image_resize.php
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';
You can’t perform that action at this time.