Skip to content

Instantly share code, notes, and snippets.

@joyrexus
joyrexus / README.md
Last active June 19, 2024 09:35 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@chadtomkiss
chadtomkiss / routes.php
Last active August 29, 2015 14:20
Organizing Laravel Routes
<?php
/*
Some tips on how best to organize your routes
#1 Routes should help you determine what URLs are available in your app,
so don't use Route::controller or Route::resource
because nobody will have a fucking clue.
@gavinballard
gavinballard / best_sellers.rb
Created November 10, 2015 15:55
"Best Sellers" script example for Mastering Shopify Apps
#!/bin/ruby
require 'shopify_api'
# This is an example script for the course "Mastering Shopify Apps"
# available at http://gavinballard.com/msa/. You're free to use and
# modify this script as desired.
# Define authentication parameters. You should update these with the
# authentication details for your own shop and private application.
SHOPIFY_SHOP='mastering-apps.myshopify.com'
@panoply
panoply / add-free-product.liquid
Created June 3, 2016 21:52
Shopify Scripts – Free product with purchase of Item. Also requires a Liquid integration.
//
{% assign found = false %}
{% for finder in product.collections %}
{% if finder.handle == 'name' %}
{% assign found = true %}
{% endif %}
{% endfor %}
{% if found == false %}
<ul>
@seedcms
seedcms / bundle script
Created January 22, 2017 01:57
10% off 3 items / 15% off 7 items via product type
item = 0
Input.cart.line_items.each do |line_item|
product = line_item.variant.product
if product.product_type == "Underwear"
item+=line_item.quantity
elsif product.product_type == "Socks"
item+=line_item.quantity
end
end
@kellyvaughn
kellyvaughn / graphql-using-vanilla-js.js
Last active January 11, 2022 23:12
Shopify GraphQL Storefront API using Vanilla JavaScript
// This example was used to pull in variant titles and IDs dynamically
// on a custom build of the ReCharge customer portal.
//
// Feel free to send me an email if you have any questions.
//
// Kelly Vaughn -- The Taproom Agency
// kelly@thetaproom.com
// 1. Retrieve product ID in any format
const productId = <pathToProductId>;