Skip to content

Instantly share code, notes, and snippets.

View VizualAbstract's full-sized avatar
📸
Haters will say this is Photoshopped

Corey Matthew Capetillo VizualAbstract

📸
Haters will say this is Photoshopped
View GitHub Profile
function getProductForm(product_id) {
var forms = document.querySelectorAll('[action^="/cart/add"]');
if (!forms.length) {
alert('ReCharge cannot load: Product form not found.');
return false;
} else if (forms.length > 1) {
var product_form;
forms.forEach(function(form, i) {
if (form[i] && form[i].getAttribute('data-productid') !== null) {
if (form[i].getAttribute('data-productid') == product_id) {
<script>
(function() {
var ReCharge = {}
ReCharge.delay = 1;
ReCharge.listener_delay = 1;
ReCharge.product_id = {{ product.id }};
ReCharge.subscription_id = {{ subscription_id }};
ReCharge.subscription_only = {{ subscription_only }};
ReCharge.subscription_first = {{ select_subscription_first }};
ReCharge.default_purchase_type = '{{ default_purchase_type }}';
@VizualAbstract
VizualAbstract / 0_reuse_code.js
Created October 27, 2016 16:24
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
<form action="/cart/add" method="post">
{% if product.variants.size > 1 %}
{% if product.options[0] %}
{% assign used = '' %}
<label for="select-one">{{ product.options[0] }}</label>
<select id='select-one' onchange="letsDoThis()">
{% for variant in product.variants %}
{% unless used contains variant.option1 %}
<option value="{{ variant.option1 }}">{{ variant.option1 }}</option>
{% capture used %}{{ used }} {{ variant.option1 }}{% endcapture %}
@VizualAbstract
VizualAbstract / hideaddrbar.js
Created March 15, 2012 01:56 — forked from scottjehl/hideaddrbar.js
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){