Skip to content

Instantly share code, notes, and snippets.

View chexton's full-sized avatar

Chris Hexton chexton

View GitHub Profile
<script>
var products = [];
<?php
var products = //Array of products
foreach ($products as $product) { ?>
// Add the product to the JS array
products.push({
name: "<?php $product['name'] ?>",
@chexton
chexton / music.txt
Created October 17, 2013 03:44
music.txt
14th Oct - Sister Hazel
16th Oct - Nico Muhly
17th Oct - Pelican
TBC - Nekrogoblikon
TBC - Jason Newsted
Artist - Title [genre] description
Youth Lagoon - Wondrous Bughouse
FIDLAR - Self titled. If you're a fan of Southern California low-fi, skate punk, you'll love it.
Chance the Rapper - Acid Rap. Not really a rap guy but I can't stop listening to it.
Disclosure - Settle has been my favourite album of the year. These two brothers came out of nowhere and produced one of the best dance albums I've ever heard! Standout tracks include Latch, Help Me Lose My Mind, and Defeated No More. Check them out!
@chexton
chexton / smileys.html
Created October 16, 2013 05:26
smileys.html
<style>
#smileys {text-align: center; padding: 40px 0 20px;}
#smileys div {width: 24px; height: 24px; display: inline-block;}
#smileys div:hover {width: 24px; height: 24px; display: inline-block; cursor: pointer;}
#smileys #green {background: url(https://www.getvero.com/assets/smiley_green.png) 0 -24px no-repeat;}
#smileys #red {background: url(https://www.getvero.com/assets/smiley_red.png) 0 -24px no-repeat;}
#smileys #green:hover {background: url(https://www.getvero.com/assets/smiley_green.png) 0 0 no-repeat;}
#smileys #red:hover {background: url(https://www.getvero.com/assets/smiley_red.png) 0 0 no-repeat;}
</style>
@chexton
chexton / vero-checkout-bc.js
Created October 11, 2013 07:38
vero-checkout-bc.js
<script type="text/javascript">
var _veroq = _veroq || [];
_veroq.push(['init', { api_key: '6672b6cfc34f0c002d2403107df20383a10d3c2d'} ]);
(function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//d3qxef4rp70elm.cloudfront.net/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();
_veroq.push(['user', {
// Required attributes
id: '%%ORDER_EMAIL%%',
email: '%%ORDER_EMAIL%%'
@chexton
chexton / magento-id.js
Created September 16, 2013 07:50
magento-id.js
<script type="text/javascript">
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$email = Mage::getSingleton('customer/session')->getCustomer()->getEmail(); ?>
_veroq.push(['user', {id: '<?php echo $email; ?>', email: '<?php echo $email; ?>', }]);
<?php } ?>
</script>
@chexton
chexton / aw-vero-sub.js
Created September 9, 2013 00:44
aw-vero-sub.js
jQuery(document).ready( function() {
jQuery('#subscribe_form').submit(function(){
form = jQuery('#subscribe_form');
email = jQuery('#nl_email').val();
_veroq.push(['user', {id: email, email: email}]);
_veroq.push(['track', 'subscribed to newsletter']);
form[0].submit();
});
});
@chexton
chexton / install-vero-bwm.js
Created August 30, 2013 12:06
install-vero-bwm.js
//1. Put this on EVERY page, just before </head>
<script type="text/javascript">
var _veroq = _veroq || [];
_veroq.push(['init', { api_key: '65d6e9dded1c0eb25b4d963b150111934efd57c2'} ]);
(function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//d3qxef4rp70elm.cloudfront.net/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();
</script>
//2. Put this on every page you know the user is logged in (/ you know their email, e.g. after they subscribe). Put it after #1
<script type="text/javascript">
@chexton
chexton / install-vero-kd.js
Created August 30, 2013 01:53
install-vero-kd.js
//1. Install this on EVERY page (header.phtml) just before </head>
//2. Install this on EVERY page where you collect a customer's email (signed in, logged in, fills out form)
<script type="text/javascript">
var email = 'customer@domain.com';
_veroq.push(['user', {
id: email,
email: email
}]);
@chexton
chexton / install-vero-ecomm.js
Last active December 21, 2015 18:29
install-vero-ecomm.js
//1. Install this on EVERY page in the header template, just before </head>
<script type="text/javascript">
var _veroq = _veroq || [];
_veroq.push(['init', { api_key: '0826fd9f355e27524590db76d0114186e17d5723'} ]);
(function() {var ve = document.createElement('script'); ve.type = 'text/javascript'; ve.async = true; ve.src = '//d3qxef4rp70elm.cloudfront.net/m.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ve, s);})();
</script>
//2. Install this below the above script on pages where you have the customer's email address. E.g. when they sign in
// or when they enter their email in checkout. Replace the "EMAIL" field with their email, dynamically.
@chexton
chexton / magento-and-vero.js
Created August 11, 2013 06:09
magento-and-vero.js
//Some of these snippets of code should be surrounded by <script></script>. They have been removed for brevity.
//1. Place this code on every page the customer is logged in, in the head.phtml file.
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()) { $email = Mage::getSingleton('customer/session')->getCustomer()->getEmail(); ?>
_veroq.push(['user', {id: '<?php echo $email; ?>', email: '<?php echo $email; ?>', }]);
// You need to get the unsubscribe status of a user from your DB. This will handle unsubscribes site-wide
<?php if(UNSUBSCRIBED) { ?>
_veroq.push(['tags', {id: '<?php echo $email; ?>', add: ['unsubscribed']}]);
<?php } else { ?>