Skip to content

Instantly share code, notes, and snippets.

@brandonsheppard
brandonsheppard / demo.js
Last active November 23, 2017 23:46
Simple form event logging with Performance Web API and jQuery
// Run on page load
$('input').on('focus blur',function(e){
performance.mark(e.type+ ' ' + e.target.name)
});
// Run to see results
console.table(performance.getEntriesByType('mark'))
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
});
observer.observe(document.getElementById('bill_selector'), {
attributes: true,
childList: true,
characterData: true
@brandonsheppard
brandonsheppard / custom.js
Created March 9, 2015 23:22
Disable Right-click on images
$('img').bind('contextmenu', function(e){
return false;
});
@brandonsheppard
brandonsheppard / printdoc.html
Last active August 9, 2017 06:06
Manipulate PDF rendering in Neto
<!--[MARGIN-TOP: 1cm]-->
<!--[MARGIN-BOTTOM: 1cm]-->
<!--[MARGIN-LEFT: 1cm]-->
<!--[MARGIN-RIGHT: 1cm]-->
<!--[PAGE-HEIGHT: xx]-->
<!--[PAGE-WIDTH: xx]-->
<!--[PAGE-SIZE: xx]-->
<!--[ZOOM: xx]-->
@brandonsheppard
brandonsheppard / 1.how.html
Created August 10, 2016 05:03
Show a modal to query the shoppers country if they aren't in Australia
<div class="modal fade" id="shipCountryModal" tabindex="-1" role="dialog" aria-labelledby="shipCountryModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form method="post" action="[@url@]">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Hello, international shopper!</h4>
</div>
<div class="modal-body">
<p>It looks like you're not shopping from Australia, where we are based&mdash;select your country below and we'll ensure you're not seeing prices which include Australia-specific taxes.</p>
@brandonsheppard
brandonsheppard / 1.md
Last active June 19, 2017 04:08
Suburb Search Shipping Calculator

@brandonsheppard
brandonsheppard / code.js
Last active February 16, 2017 05:13
Run function after add to cart success
// Note: the best way to do this is:
$(document).ajaxComplete(function( event, xhr, settings ) {
// insert logic here based on the values of `settings`, `event` & `xhr`
});
// Alternative: mutation observer (which sucks)
// This code will run the function enableATC when Add to cart is completed.
// What it does is, watch #theCartCount and run the function enableATC whenever it changes.
// #theCartCount is an ID you need to give to the span that contains the amount of items in cart. This span has a rel of a2c_item_count by default
// See: https://github.com/NetoECommerce/Skeletal/blob/master/private/www/netosuite/Templates/skeletal/headers/template.html#L53
@brandonsheppard
brandonsheppard / gist:88fcc88b1ae7b93d8b11
Created September 15, 2014 04:33
Generate a sitemap with B@SE
<ul>
[%content_menu content_type:'category' limit:''%]
[%param header%]
<li>Categories
<ul>
[%/param%]
[%param *level_1%]
<li><a href="[@url@]">[@name@]</a>
[%if [@next_level@]%]
<ul>
@brandonsheppard
brandonsheppard / how.md
Created July 26, 2016 05:45
How to use $.nShowActivity('.nactivity')

You need to add a FontAwesome loader to this div. There are a list of options here.

You then simply need to run the function when you need the loader to display:

$.nShowActivity('.nactivity')
@brandonsheppard
brandonsheppard / variables.scss
Created June 29, 2016 04:56
Neto colours in SCSS variables
// Neto colours in SCSS variables
// Primary colour palette
$netoBlue: #47BFEE;
$netoOrange: #FFC907;
$netoGreen: #56C1A8;
$netoCandyRed: #EF4A7E;
// Secondary colour palette - Dark
$netoBlue--dark: #26AAD8;