Skip to content

Instantly share code, notes, and snippets.

@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active November 8, 2024 12:01
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@leobossmann
leobossmann / ee_funnel.js
Last active September 3, 2020 05:25
Checkout Steps for Enhanced Ecommerce labelling, originally by Rob Edlin, https://ecommerce.shopify.com/c/shopify-discussion/t/checkout-labelling-417229
var step_number = 0;
switch (Shopify.Checkout.step) {
case "contact_information":
step_number = 1;
break;
case "shipping_method":
step_number = 2;
break;
@NigelEarle
NigelEarle / Knex-Migrations-Seeding.md
Last active October 31, 2024 18:18
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

/* eslint no-undef: 0*/
/* eslint react/jsx-no-undef: 0*/
import React from "react"
const chart = {
id: "purchase",
initial: "fetchingWorkshopData",
states: {
fetchingWorkshopData: {
on: {
@litch
litch / shopify.md
Last active March 20, 2019 07:50 — forked from lambtron/shopify.md
segment event tracking for shopify
title sidebar
Segment Event Tracking for Shopify
Shopify

Segment makes it simple for Shopify merchants to integrate analytics, email marketing, advertising and optimization tools. Rather than installing all your tools individually, you just install Segment once. We collect your data, translate it, and route it to any tool you want to use with the flick of a switch. Using Segment as the single platform to manage and install your third-party services will save you time and money.

The guide below explains how to install Segment in your Shopify store. All you need to get up and running is copy and paste a few snippets of code into your theme editor. (You don't have to edit the code or be versed in JavaScript.) The following guide will show you how, step by step.


@iambrianreich
iambrianreich / google-reviews.php
Last active November 12, 2021 21:02
Use the Google Places API to render a Google My Business reviews badge on a WordPress site using shortcodes.
<?php /** @noinspection SpellCheckingInspection */
/**
* This file contains the WordPress code for rendering a Google Reviews badge.
*
* Usage:
*
* 1. Create a Google API Console account if you have not already done so.
* 2. Register for the Google Places API.
* 3. Create an API key.
* 4. Ensure that the API key can be used from wherever this script will execute
var KlaviyoSubscribe = KlaviyoSubscribe || {};
(function() {
if (!KlaviyoSubscribe._loaded) {
KlaviyoSubscribe._loaded = !0;
var m = {
"modal.html": '<div class="klaviyo_modal" style="display:none;"><div class="klaviyo_inner"><a href="#" class="klaviyo_close_modal klaviyo_header_close">&times;</a><form action="" method="POST" novalidate="novalidate" class="klaviyo_subscription_form"><input type="hidden" name="g" value="" /><p class="klaviyo_header"></p><p class="klaviyo_subheader"></p><div class="klaviyo_fieldset"></div><div class="klaviyo_fine_print"></div><div class="klaviyo_form_actions"><button type="submit" class="klaviyo_submit_button"><span></span></button></div><div class="klaviyo_below_submit"></div><div class="error_message" style="display:none;"></div></form><div class="success_message" style="display:none;"></div></div></div>',
"flyout.html": '<div class="klaviyo_flyout" style="display:none;"><div class="klaviyo_inner"><div class="klaviyo_topbar" /><a href="#" class="klav
@seedcms
seedcms / product-swatches-json.liquid
Last active July 9, 2019 08:59
Product Swatches APP JSON example
<div class="swatchslider">
<ul class="slides product-swatches-{{product.id}}"></ul>
</div>
<div style="clear:both;"></div>
<script>
/*$(window).load(function() {
$('.swatchslider').flexslider({
animation: "slide",
animationLoop: false,
@eguven
eguven / brew-list.sh
Last active November 16, 2024 19:55
List all packages installed using Homebrew and their sizes
# this original one uses values returned from 'brew info'
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
# faster alternative using 'du'
du -sch $(brew --cellar)/*/* | sed "s|$(brew --cellar)/\([^/]*\)/.*|\1|" | sort -k1h
@samsolomon
samsolomon / Create Random Number in Liquid
Last active September 30, 2019 02:52
This code will work to give you a random number to use in Liquid. Works in customer.io.
<!--create a semi-random number using the last second of the send date-->
{% capture time_seed %}
{{ 'now' | date: "%s" }}
{% endcapture %}
<!--manupulate using lots of maths-->
{% assign random = time_seed | times: 1103515245 | plus: 12345 | divided_by: 65536 | modulo: 32768 | modulo: 10 %}
<!--return number-->
{{ random }}