Skip to content

Instantly share code, notes, and snippets.

@dturton
dturton / docker.md
Created December 18, 2022 18:07 — forked from zmts/docker.md
Docker, TypeScript, Node.js

Docker, TypeScript, Node.js

Preconditions:

  • TS application listening port: 7777
|-- dist
|-- src
|-- .dockerignore
|-- Dockerfile
@dturton
dturton / index.js
Created November 23, 2020 17:25 — forked from vladgovor77771/index.js
Queue arena based on bullmq. Allows chaining jobs.
const { Queue, QueueEvents } = require('bullmq');
const { EventEmitter } = require('events');
const config = require('../config');
const createUid = require('uid');
class QueueArena extends EventEmitter {
constructor({ redisDb = 1 }) {
super();
this.redisDb = redisDb;
import Axios from 'axios'
state = {
todos : null
},
getters = {
TODOS : state => {
return state.todos;
}
},
@dturton
dturton / README.md
Created November 7, 2018 19:26 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
# Stop customers from using a discount code
# This script will reject all discount codes. Useful if you have a sale
# and don't want additional discounts to be applied
# Set the rejection message for discount codes
REJECTION_MESSAGE = "Discount codes cannot be used during this sale"
class RejectAllDiscountCodes
# Initializes the campaign.
#
@dturton
dturton / gift-modal.md
Created May 12, 2018 13:55 — forked from jgodson/gift-modal.md
Free Gift Modal for Shopify Themes

How to install

  1. Copy the following code and paste it at the end of config/settings_schema.json, just after the last }. Then save the file.
,
  {
    "name": "Free Gift Offer",
    "settings": [
      {
        "type": "header",
        "content": "Offer a free gift with discount code on cart page"
@dturton
dturton / Free Gift.rb
Created January 18, 2018 18:07 — forked from HillbergAndBerkIT/Free Gift.rb
Shopify Scripts
# See https://onlygrowth.com/blogs/posts/17-shopify-scripts-to-maximize-conversions for some helpful snippets
class FreeGift
def initialize(variant_id, minTotal, message, quantity = 1)
@variant_id = variant_id
@minTotal = minTotal
@message = message
@giftQuantity = quantity
end
# Get the total of the cart without the variant price being included
discounted_product = 12275195905
products_needed = [592406273]
products_seen = []
Input.cart.line_items.each do |line_item|
product = line_item.variant.product
products_seen << product.id if products_needed.include?(product.id)
end
Input.cart.line_items.each do |line_item|
{% comment %}
To add a companion product to the cart automatically if a primary product is in cart:
1. Create a new link list under your Navigation tab.
2. In that link list, make the first link point to companion product.
3. Copy your link list handle where indicated at line 9
4. Set the minimum cart total required for the bonus product on line 10
{% endcomment %}
{% assign linklist = linklists['put-your-link-list-handle-here'] %}
{% assign min_total = 100 %}
@dturton
dturton / Much much simpler option selector for Shopify
Created April 29, 2017 15:04 — forked from zakhardage/Much much simpler option selector for Shopify
Much simpler version of Shopify's option_selection.js for separating product options into their own dropdown menus.
<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 %}