Skip to content

Instantly share code, notes, and snippets.

View CaroRed's full-sized avatar
🎯
Focusing

Carolina Rojas CaroRed

🎯
Focusing
View GitHub Profile
@codingjester
codingjester / upload.php
Created January 20, 2012 22:09
Working PHP example of uploading a photo with V2 api
<?php
#Requires PHP 5.3.0
define("CONSUMER_KEY", "consumer_key");
define("CONSUMER_SECRET", "consumer_secret");
define("OAUTH_TOKEN", "access_token");
define("OAUTH_SECRET", "access_secret");
function oauth_gen($method, $url, $iparams, &$headers) {
@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
@bishwanathjha
bishwanathjha / contiguous_subarray_sum.php
Created October 23, 2016 15:28
Largest Sum Contiguous Subarray in PHP
<?php
/**
* @author Bishwanath Jha <bishwanathkj@gmail.com>
* Largest Sum Contiguous Subarray
*/
function GetMaxSum($array) {
$total = $max_total = 0;
$count = count($array);
for($i = 0; $i < $count; $i++) {
$total += $array[$i];