Skip to content

Instantly share code, notes, and snippets.

View jamsea's full-sized avatar

James Hush jamsea

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<root>
<creditcard>
<number>19834209</number>
<expiry>02/02/2002</expiry>
</creditcard>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );
function woo_custom_add_to_cart($cart_item_data) {
global $woocommerce;
$items = $woocommerce->cart->get_cart(); //getting cart items
$_product = array();
foreach($items as $item => $values) {
$_product[] = $values['data']->post;
var_dump($values);
@jamsea
jamsea / cloudSettings
Last active November 9, 2016 21:49
Visual Studio Code Sync Settings GIST
{"lastUpload":"2016-11-09T21:49:20.788Z"}
@jamsea
jamsea / cloudSettings
Last active July 30, 2019 02:19
Visual Studio Code Sync Settings GIST
{"lastUpload":"2019-07-30T02:19:23.713Z","extensionVersion":"v3.4.1"}
@jamsea
jamsea / sorty.js
Created January 18, 2017 06:09
Sorty stuff
var equation = ["+2x", "+1y", "-1x", "+2y"];
var equationRegex = /[a-zA-Z].*/g;
var numberRegex = /\+([^;]*)[a-zA-z]/g; // Make this the right regex, should match the number part and the sign e.g +3.5
function sortEquation(a, b) {
var valueA = a.match(equationRegex)[0];
var valueB = b.match(equationRegex)[0];
if (valueA < valueB) {
return -1;
@jamsea
jamsea / citySort.js
Last active April 17, 2018 07:09
City Sort
const cities = [
{ "San Francisco": 3000 },
{ "Los Angeles": 5000 },
{ "San Francisco": 3000 },
{ Sacramento: 2000 }
];
const uniqueCityFilter = (cityObject, index, array) => {
return (
index ===
@jamsea
jamsea / citySort.ts
Created April 17, 2018 07:09
City Sort (Typescript)
interface ICity {
[key: string]: number;
}
const cities: ICity[] = [
{ "San Francisco": 3000 },
{ "Los Angeles": 5000 },
{ "San Francisco": 3000 },
{ Sacramento: 2000 }
];
@jamsea
jamsea / cloudSettings
Last active September 15, 2021 15:33
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-09-15T15:33:45.998Z","extensionVersion":"v3.4.3"}
@jamsea
jamsea / SynchShopify.sh
Created December 18, 2018 06:39
Auto Sync Shopify
#!/bin/bash
# Get Theme (install themekit here, probably a good idea to copy/paste these commands to the top https://shopify.github.io/themekit/)
theme get --password=[your-api-password] --store=[your-store.myshopify.com] --themeid=[your-theme-id]
unzip ThemeName.zip
cp -R ThemeName/ WhereYourThemeIs/
cd WhereYourThemeIs/ || exit 0
git checkout -b themeChanges
git push origin themeChanges