This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #nginx config file for Nextjs App | |
| #place in /etc/nginx/sites-available/name_of_config_file | |
| server { | |
| listen 80; | |
| server_name domainname.com; | |
| gzip on; | |
| gzip_proxied any; | |
| gzip_types application/javascript application/x-javascript text/css text/javascript; | |
| gzip_comp_level 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # usage: JWT_SECRET="silly" mk-jwt-token | |
| # @WARN: modify the payload and header to your needs. | |
| # | |
| main(){ | |
| set -eo pipefail | |
| [ -n "$JWT_SECRET" ] || die "JWT_SECRET environment variable is not set." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script | |
| src="https://code.jquery.com/jquery-3.3.1.min.js" | |
| integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" | |
| crossorigin="anonymous"></script> | |
| <script> | |
| var cartCount = {{ cart.item_count }}; | |
| $(document) | |
| .ready(function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery.getJSON('/cart.js', function(cart) { | |
| items = cart.items; | |
| var results = items.filter(x => x.id === 6223106801703); | |
| if ((results.length == 0) && (items.length > 0)) { | |
| jQuery.post('/cart/add.js', { | |
| quantity: 1, | |
| id: 6223106801703 | |
| }); | |
| location.reload(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (typeof Shopify === 'undefined') var Shopify = {}; | |
| Shopify.cart = {{ cart | json }}; | |
| Shopify.toAdd = 378589397; | |
| var surchargeInCart = false; | |
| var total = 2507; // total in cents. | |
| for (var i=0; i<Shopify.cart.items.length; i++) { | |
| if (Shopify.cart.items[i].id === Shopify.toAdd) { | |
| surchargeInCart = true; | |
| total -= Shopify.cart.items[i].line_price; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% comment %} | |
| Shopify responsive product images with srcset. | |
| Example: | |
| Include this snippet on a product page or within a products loop: | |
| {% include 'product-image-srcset', | |
| sizes: '(max-width: 640px) 50vw, (min-width: 641px) and (max-width: 960px) 33vw, 25vw' %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Project: Shopify AJAX Cart Plugin | |
| * Description: Provides AJAX cart functionality for interacting with the Shopify AJAX API so you don't need an "Update Cart" button | |
| * Dependency: jQuery 1.6+ | |
| * Author: Ryan Marshall (ryan@schmoove.co.nz) | |
| * License: Free | |
| * Usage: | |
| * | |
| * $('#cart-form').shopifyAJAXCart({ | |
| * item: '.line-item-container', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Shopify = Shopify || {}; | |
| // --------------------------------------------------------------------------- | |
| // Money format handler | |
| // --------------------------------------------------------------------------- | |
| Shopify.money_format = "${{amount}}"; | |
| Shopify.formatMoney = function(cents, format) { | |
| if (typeof cents == 'string') { cents = cents.replace('.',''); } | |
| var value = ''; | |
| var placeholderRegex = /\{\{\s*(\w+)\s*\}\}/; | |
| var formatString = (format || this.money_format); |