Skip to content

Instantly share code, notes, and snippets.

View markpinero's full-sized avatar

Mark Pinero markpinero

View GitHub Profile
{%- liquid
assign cart_item_ids = cart.items | map: 'product_id' | join: ','
assign cart_collection_size = cart_collection.products.size
assign product_form_id = 'product-form-' | append: section.id
for product in cart_collection.products
if cart_item_ids contains product.id
assign cart_collection_size = cart_collection_size | minus: 1
endif
endfor
@markpinero
markpinero / Nework_throttling_profiles.md
Created April 20, 2024 21:34 — forked from theodorosploumis/Nework_throttling_profiles.md
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
@markpinero
markpinero / 0-self-publishing.md
Created November 5, 2023 09:08 — forked from caseywatts/0-self-publishing.md
Self-Publishing via Markdown
@markpinero
markpinero / Injector.tsx
Created October 14, 2023 00:26 — forked from zb-sj/Injector.tsx
storybook-invoke-addon idea
import React, { useEffect, useState } from 'react';
import { useArgs, useArgTypes } from '@storybook/manager-api';
import { ArgTypes } from '@storybook/types';
import { CONTROL_TYPE, DOCBLOCK_ARGSTABLE_SELECTOR, PANEL_TAB_CONTENT_ID } from '../constants';
import { InvokerControlInjector } from './InvokerControlInjector';
export function Injector() {
const [args] = useArgs();
const argTypes = useArgTypes();
@markpinero
markpinero / gift_template.liquid
Created July 26, 2023 18:12 — forked from jamesheston/gift_template.liquid
The default gift_card.liquid template in Shopify. Just here in case one needs it quickly without having to fool around with their current theme files through the admin.
{% layout none %}
{% assign formatted_initial_value = gift_card.initial_value | money_without_trailing_zeros: gift_card.currency %}
{% assign formatted_initial_value_stripped = formatted_initial_value | strip_html %}
<!DOCTYPE html>
<html>
<head>
(function () {
function loadZendeskChat(callback) {
var zdscript = document.createElement('script');
zdscript.setAttribute('id','ze-snippet');
zdscript.src = 'https://static.zdassets.com/ekr/snippet.js?key=XXX-XXX-XXX-XXX';
(document.getElementsByTagName('body')[0]).appendChild(zdscript);
window.zdonload = setInterval(function(){
if(typeof zE !== "undefined" && typeof zE.activate !== "undefined") {
@markpinero
markpinero / cookiebot-frame.js
Created June 15, 2022 17:02
cookiebot-frame.js
/**
* If a user does not allow cookies (Youtube : marketing, Calameo : marketing and statistics),
* displays a message before all blocked iframes (iframes.cookieconsent-optin-marketing)
*
* Cookiebot user preferences are stored in :
* bool Cookiebot.consent.preferences
* bool Cookiebot.consent.statistics
* bool Cookiebot.consent.marketing
*
* Can be changed with Cookiebot.submitCustomContent(preferences,statistics,marketing)
import React from 'react';
import Html from '../components/html'; // wraps pages into <html> and some common layout
// you might want a webpack.config.js at least for styles
// typically we use a sass loader, and also @emotion/react in our components
// Html will take care to add <link> for built ./build/**/*.css
// and <script> for built ./build/**/*.js if any, you might even inline it <script>{content}</script> if short
// It's also possible to build css/js assets per page, we didn't do that
export async function getServerSideProps({ req }) {
import querystring from 'querystring';
import fetch from 'node-fetch';
const API_KEY = '';
const LIST_ID = '';
const URL = `https://emailoctopus.com/api/1.5/lists/${LIST_ID}/contacts`;
exports.handler = async (event, context) => {
const params = querystring.parse(event.body);