Skip to content

Instantly share code, notes, and snippets.

View alankimo's full-sized avatar
🏠
Working from home

Alan K. alankimo

🏠
Working from home
  • Ciudad de México
View GitHub Profile
@alankimo
alankimo / imgURL.js
Created January 18, 2019 21:01 — forked from DanWebb/imgURL.js
Specify a size for a Shopify image asset url. Equivalent to the liquid image size filter: `{{ image | img_url: "medium" }}`
String.prototype.imgURL = function(size) {
// remove any current image size then add the new image size
return this
.replace(/_(pico|icon|thumb|small|compact|medium|large|grande|original|1024x1024|2048x2048|master)+\./g, '.')
.replace(/\.jpg|\.png|\.gif|\.jpeg/g, function(match) {
return '_'+size+match;
})
;
};
@alankimo
alankimo / getOrder_Shopify.php
Created September 28, 2017 16:26
Eso es un ejemplo de como mandar un request sin JSON concatenado los varoles en la URL mediante GET.
<? php
function orderStatus($data_0, $data_1, $data_2, $data_3, $data_4, $data_5, $data_6, $data_7, $data_8, $data_9) {
$payload = 'x_account_id=' . $data_1 . '&x_reference=' . $data_2 . '&x_currency=' . $data_3 . '&x_test=' . $data_4 . '&x_amount=' . $data_5 . '&x_gateway_reference=' . $data_6 . '&x_timestamp=' . $data_7 . '&x_result=' . $data_8 . '&x_signature=' . $data_9;
$session = curl_init();
curl_setopt($session, CURLOPT_URL, $data_0); // $putUrl
curl_setopt($session, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($session, CURLOPT_TIMEOUT, 30);
curl_setopt($session, CURLOPT_HEADER, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER,true);
<?php
function updateCustomer($api_url, $api_key, $api_pswd, $customer_id, $billing_agreement, $tags_default) {
$baseUrl = "https://".$api_key.":".$api_pswd."@".$api_url."/admin/";
$tagsFix = $tags_default . ', 20XX-' . $billing_agreement;
//Set up JSON payload
$payload = array(
"customer" => array(
'id' => $customer_id,