Skip to content

Instantly share code, notes, and snippets.

View blboyle's full-sized avatar

Brendan Boyle blboyle

View GitHub Profile
@blboyle
blboyle / gp_google_autocomplete.liquid
Created May 29, 2017 14:21
Copy this code into a snippet, then load that snippet into checkout.liquid
<!-- Snippet gp_google_autocomplete -->
{% if gp_google_autocomplete %}
{% assign gp_api_key = settings.gp_add_merchant_api_key | strip %}
{% unless gp_api_key == '' %}
<script>
var pageChangeChecker = function(name, section, callback) {
// checking for a specific class-attribute, else it's been erased by page:change
if (!$(section).hasClass(name)) {
if (typeof(callback) === 'function') {
@blboyle
blboyle / gp_checkout_autocomplete.js
Created May 29, 2017 14:19
Constructor for Google Place Autocomplete
var GpCheckoutAutocomplete = (function() {
function GpCheckoutAutocomplete() {
this.enableGeolocate = false;
this.countryError = 'Please select valid country';
this.addressInput = 'shipping_address';
this.address1ErrorPlaceholder = 'Address';
this.authFailure = false;
this.googleMapsCircle = {};
this.boundsInterval = {};
this.componentForm = {};
@blboyle
blboyle / appendTo_en-default-json
Created May 29, 2017 14:18
Add this to the bottom of your locales/en.default.json file
,
"google_places": {
"checkout": {
"field_errors": {
"country_invalid": "Please select valid country"
}
}
}
@blboyle
blboyle / gp_settings_schema_addition
Created May 29, 2017 14:17
Add this to the bottom of your settings_scheme.json
,
{
"name": "Google Places Autocomplete",
"settings": [
{
"type": "header",
"content": "Google Places Autocomplete"
},
{
"type": "paragraph",
@blboyle
blboyle / checkout-liquid_head
Created May 29, 2017 14:15
This is code that you put into the head of your checkout.liquid
{{ '//code.jquery.com/jquery-1.12.4.min.js' | script_tag }}
{% include 'gp_google_autocomplete' with settings.gp_enable_google_autocomplete %}
@blboyle
blboyle / 0_reuse_code.js
Created September 30, 2015 14:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@blboyle
blboyle / SassMeister-input-HTML.html
Created June 8, 2015 15:41
Generated by SassMeister.com.
<div>
<div class="something03"></div>
<div class="something02"></div>
<div class="something01"></div>
<div class="something1"></div>
<div class="something2"></div>
<div class="something3"></div>
<div class="something4"></div>
</div>