Skip to content

Instantly share code, notes, and snippets.

View keiraarts's full-sized avatar
🍊

Keira Climson keiraarts

🍊
View GitHub Profile
import React, { useMemo, useCallback } from 'react';
import {
reactExtension,
Style,
View,
Text,
Button,
Image,
BlockStack,
} from '@shopify/ui-extensions-react/checkout';
/*------------------------
Libraries
------------------------*/
const axios = require("axios");
const fs = require("fs");
const FormData = require("form-data");
/*------------------------
Download the file.
Good article on how to download a file and send with form data - https://maximorlov.com/send-a-file-with-axios-in-nodejs/
@shafiimam
shafiimam / file.md
Created December 4, 2021 10:23
Shopify next js route propagation

Shopify NextJs App Route Propagation

In shopify next js app page are generated in the server and then served to client side. Under the hood next js uses react's routing to dynamically update the browser URL without reloading the page again and again.

To make this work and change the URL without loading the page inside a shopify embedded app's iframe follow these steps

  1. Create a file named RoutePropagator.js.
  2. Paste this code inside RoutePropagator.js
import React from "react";
import Router, { useRouter } from "next/router";
@fernandonm
fernandonm / powattack.md
Last active January 17, 2022 09:11
How much does it cost to destroy Bitcoin?

How much does it cost to destroy Bitcoin?

There has been a dreaded myth surrounding the so-called 51% PoW attacks against Bitcoin since inception. It is often believed that anyone able and willing to spend an amount equal to the “security budget” forever can destroy Bitcoin. That is, any evil government willing to spend about $60 million per day (matching miner’s revenue) would be able to destroy its $1.16 trillion current market capitalization. And worse, this figure may become lower and lower as halvings arrive if fee revenue is not able to take off consistently. Note that “forever” is just a credible threat, he will only need to spend that money for a period of time long enough until Bitcoin has been destroyed, which may be just a few weeks (at $420 million per week).

Here I will try to explain why the mentioned figure (currently 0.005% of bitcoin’s mcap per day) is not nearly enough to destroy Bitcoin, and show why it is unlikely that an attacker would carry such an ineffective attack for a long perio

@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active March 17, 2025 06:52
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@edmundcwm
edmundcwm / edm-display-product-thumbnail-in-emails.php
Last active August 4, 2018 09:46
Woocommerce: Display order item thumbnails in transaction emails
<?php
/*
* Enable order item thumbnail display in emails
* Change order item thumbnail size
* @see woocommerce/includes/wc-template-functions.php for hook
*/
function edm_display_product_thumbnail_in_emails( $args ) {
/* Display image thumbnail in emails */
$args['show_image'] = true;
@levelsio
levelsio / levelsio-by.html
Last active July 17, 2025 10:31
Maker Link (aka the @levelsio by link)
<!-- Maker Link by @levelsio -->
<!-- MIT License -->
<style>
body {
background:#333;
}
.levelsio-by {
font-family:"Helvetica Neue",sans-serif;
right:0;

Gmail Filters

Catch newsletters and junk

Matches: ("opt-out" OR unsubscribe OR "viewing the newsletter" OR "privacy policy" OR enews OR "edit your preferences" OR "email notifications" OR "update profile" OR smartunsubscribe OR secureunsubscribe OR yahoogroups OR "manage your account" OR "group-digests") Do this: Skip Inbox, Apply label "Work/Newsletters"

Keep pesky calendar invites out of inbox

Matches: (subject:("invitation" OR "accepted" OR "rejected" OR "updated" OR "canceled event" OR "declined") when where calendar who organizer) Do this: Skip Inbox, Apply label "GTD/Follow up"

Keep 90% of Sales emails out of Inbox

@lukecav
lukecav / Command
Created October 2, 2017 17:48
Sales by SKU using a MySQL query if using WooCommerce
SELECT
sku, count(1)
FROM
wp_woocommerce_order_items oi, -- orders table
wp_posts p, -- woocommerce use posts to keep metadata on the order
wp_postmeta pm, -- we use this table to filter the completed orders
wp_postmeta pm1, -- we use this table again for getting the shipping country info
wp_woocommerce_order_itemmeta oim, -- use this table to get product ids from orders
(SELECT p.id as product_id, meta_value as sku FROM wp_posts p, wp_postmeta pm where
post_type='product' and post_status='publish'
@keithweaver
keithweaver / s3-upload-via-link.php
Last active May 18, 2023 16:44
Upload image using link to AWS S3 with PHP