Skip to content

Instantly share code, notes, and snippets.

View hrdwdmrbl's full-sized avatar
👨‍🎨
Creating

Marc Beaupre hrdwdmrbl

👨‍🎨
Creating
View GitHub Profile
@hrdwdmrbl
hrdwdmrbl / changedDescendants.ts
Last active December 22, 2025 21:37 — forked from BrianHung/changedDescendants.ts
prosemirror changed nodes / part of document by transaction
/**
* Helper for iterating through the nodes in a document that changed compared
* to the given previous document. Useful for avoiding duplicate work on each transaction.
* Source: https://github.com/ProseMirror/prosemirror-tables/blob/master/src/fixtables.js
*/
import type { Node as PMNode } from "prosemirror-model"
export function changedDescendants(old: PMNode, cur: PMNode, offset: number, f: (node: PMNode, pos: number) => void) {
let oldSize = old.childCount, curSize = cur.childCount
outer: for (let i = 0, j = 0; i < curSize; i++) {
@hrdwdmrbl
hrdwdmrbl / -Shopify-Sendy.md
Created May 5, 2020 17:18 — forked from ridem/-Shopify-Sendy.md
Synchronize Shopify customers with Sendy

Synchronize Shopify customers with Sendy subscribers

Sendy woudln't be the Mailchimp killer without a proper Shopify integration. There we go, thanks to the Shopify gem and some ActiveRecord awesomeness.

NB: The script always keep in sync Shopify's accepts_marketing field with Sendy's unsubscribed field. I added custom fields like country and order count as an example of what we can do with it.

Installation

First make sure that you have the right ruby install (with rbenv for instance), with the right gems installed (like activerecord, shopify_api, etc) and the right mysql packages for the activerecord adapter;