Skip to content

Instantly share code, notes, and snippets.

View alxgmpr's full-sized avatar
:shipit:

Alex Gompper alxgmpr

:shipit:
  • TryNow Inc
  • Colorado Springs
View GitHub Profile
@alxgmpr
alxgmpr / shopify-stop-bots.md
Created June 13, 2019 18:14
A common sense guide to avoiding botted releases

A short guide on how to beat, fool, and trick Shopify bots and prevent them from checking out on your store.

  1. Do not publish products live on the store until drop time. Loading a product live on the site and then quickly un-publishing it has already given away your product to bots and scrapers, which log every product that publishes on your site.

  2. Do not add variants to your product until it is ready to go live. Similar to #1, loading variants of your product before release time gives them away to bots.

  3. Cycle your API keys and credentials for any private app that you use. API keys allow for access to published and unpublished products. If they leak or are revealed, everyone will have backend access to your products. Cycle these often and before releases (before you draft your release products).

  4. Enter password-mode on your storefront well before release time. This will allow any pre-generated checkout sessions to expire and level the playing field once your product releases and goes into a queue.

@alxgmpr
alxgmpr / tasks.json
Created August 22, 2019 16:54
Template for how to lay out auto-checkout tasks in JSON format
{
"tasks": [
{
"first_name": "",
"last_name": "",
"email": "",
"phone": "",
"address_1": "",
"address_2": "",
@alxgmpr
alxgmpr / form_data.md
Last active September 19, 2021 14:47

Sometimes, it is useful to gather form data from a webpage en masse.

The quick-script way to do this is to iterate via document.forms and construct FormData objects for each form on the page.

// es6 spread converts fancy collection obj into plain array
const allForms = [...document.forms]

allForms.forEach((f) => {
  const fd = new FormData(form)

Enforcing Singletons

Lateley at work, I've become invested in making sure that we only have one of things. In modern development, we are blessed with patterns that don't require instantiating expensive things, or not having to worry about creating them at all. But when working with service class instances which talk over the wire, it becomes imperative to enforce expensive operations only being done once, and moreover ensuring that multiple consumers of the same singleton don't duplicate requests.

Simple Window Instance

I've found that the easiest way to ensure instantiation only occurs once (in browser contexts) is to use the window.

Using UCG Ultra + Cloudflare Dynamic DNS + Cloudflare SSL

Motivation

  • Want to expose the Unifi console via a public domain like unifi.mydomain.com.
  • Theoretically if unifi.ui.com goes down this proxy would continue to work.
  • Also just good practice hackin'

Background