Skip to content

Instantly share code, notes, and snippets.

@milesw
milesw / product.liquid
Last active April 22, 2022 13:24
Specify environment image on Shopify 3D model
{% comment %} Before {% endcomment %}
{{ media | model_viewer_tag: image_size: '1024x', reveal: 'interaction', toggleable: true }}
{% comment %} After {% endcomment %}
{%- assign environment_image = settings.models_environment_image | default: 'neutral' -%}
{{ media | model_viewer_tag: image_size: '1024x', reveal: 'interaction', toggleable: true, environment-image: environment_image }}
{%- comment -%}
Google Tag Manager scripts for checkout.liquid
Note: This script must run after {{ checkout_scripts }}
{%- endcomment -%}
{% assign order_data = checkout.order %}
{% assign customer_data = checkout.customer %}
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
@milesw
milesw / rcWidget.js
Last active June 26, 2024 17:46
rcWidget.js
import 'core-js/es6/array';
import 'core-js/es6/object';
import 'core-js/es6/string';
// Global options
import defaults from './_config';
// general helper functions
import Helper from './_helpers';
// general pricing and currency functions
import Pricing from './_pricing';
// throttle and debounce manager
@milesw
milesw / serverless.yml
Created August 16, 2018 12:53
Ping a Heroku App Using Serverless / AWS Lambda
service: myapp-ping
provider:
name: aws
runtime: nodejs8.10
environment:
PING_URL: https://myapp.herokuapp.com
functions:
ping:
@milesw
milesw / gist:8268453c1efb4b20fdd1f78564b0eed2
Created December 22, 2016 03:33
MySQL - blank out domains in email addresses
UPDATE table_name
SET email_field = CONCAT(LEFT(email_field, INSTR(email_field, '@')), 'localhost.localdomain')
@milesw
milesw / StaticCorsValetDriver.php
Created December 3, 2016 08:02
Laravel Valet driver that serves static files with CORS header
<?php
class StaticCorsValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@milesw
milesw / gist:64281684263a315202fd74a681807938
Created July 10, 2016 07:28
Fix Thai subtitle file encoding
iconv -f ISO_8859-11 -t UTF-8 original.srt > fixed.srt
### Keybase proof
I hereby claim:
* I am milesw on github.
* I am milesw (https://keybase.io/milesw) on keybase.
* I have a public key whose fingerprint is 0370 6B39 E559 6DE1 924A 4C66 E450 CD16 4F9C 990B
To claim this, I am signing this object: