Skip to content

Instantly share code, notes, and snippets.

View davidfurlong's full-sized avatar
👨‍💻

David Furlong davidfurlong

👨‍💻
View GitHub Profile
@davidfurlong
davidfurlong / JSON.stringify-replacer-sort-keys.js
Last active May 5, 2024 06:00
JSON.stringify replacer function for having object keys sorted in output (supports deeply nested objects)
// Spec http://www.ecma-international.org/ecma-262/6.0/#sec-json.stringify
const replacer = (key, value) =>
value instanceof Object && !(value instanceof Array) ?
Object.keys(value)
.sort()
.reduce((sorted, key) => {
sorted[key] = value[key];
return sorted
}, {}) :
value;
LLM Image creation
Advanced NFT minting
GIPHY gifs
IPFS image uploader
NFT Minting mini-app
ChatGPT shorten text mini app
Create a gasless zora NFT
Subscriptions/Token gated casts (using Lit)
ERC-20 Swaps/Fiat
Video player (using Livepeer)
// Welcome to Code in Framer
// Get Started: https://www.framer.com/developers/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { addPropertyControls, ControlType } from "framer";
import { useInView, motion } from "framer-motion";
import { useRef, useEffect, useState } from "react";
/**
* These annotations control how your component sizes
* Learn more: https://www.framer.com/developers/#code-components-auto-sizing
/**
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { createStore } from "https://framer.com/m/framer/store.js@^1.0.0";
import { useEffect, useState, useRef, useCallback } from "react";
import { addPropertyControls, ControlType, RenderTarget } from "framer";
import { motion } from "framer-motion";
import { useSwipeable } from "https://framerusercontent.com/modules/6pcIVukgG0tVOg4yaIck/a3hKVXMwf9T1lIRSVt0U/Helpers.js";
import { rgbToArray } from "https://framerusercontent.com/modules/LxTINgasBGoX7JtSU6qZ/h7jvPi5x1iTndnDxH6ha/Utils.js";
const useStore = createStore({ current: 0, maxCurrent: 0, cursor: "" });
function calculateScalingFactor(
screenWidth,
@davidfurlong
davidfurlong / url-regex.js
Last active December 30, 2022 13:20
url regex discove
// The characters "," and ")" are often used by users at the end of the url, without them intending for them
// to be considered part of the url. As these are valid characters of a query, it's up to you to remove them
const urlRegex = /((?:(?:(?:https?|ftp):)?\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:northwesternmutual|travelersinsurance|vermögensberatung|vermögensberater|americanexpress|kerryproperties|sandvikcoromant|americanfamily|bananarepublic|cookingchannel|kerrylogistics|weatherchannel|international|lifeinsurance|travelchannel|wolterskluwer|construction|lplfinancial|scholarships|versicherung|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterpr
@davidfurlong
davidfurlong / Bookshelf-postgis.md
Last active February 28, 2022 05:47
Use Bookshelf with postgis and knex-postgis without the hassle

How to use Bookshelf with postgis and knex-postgis without the hassle

Using Bookshelf.js with postgis and knex-postgis is a huge pain in the ass.

TLDR - Override Bookshelf methods to parse postgis formats in JS, not in SQL to avoid having to do awkward Bookshelf modifications anywhere you make a bookshelf insert/update/delete on Geo data (middleware like approach)

class Event extends Bookshelf.Model {
  get tableName() { return 'event'; }
@davidfurlong
davidfurlong / patch.sh
Last active December 22, 2021 12:20
Interactive bash script to create a branch, commit, push, open a pull request on github, and request review with current changes. For the time-conscious devs out there. Use as `sh patch.sh`
#!/bin/bash
# To use, run `sh patch.sh`.
# This is useful for small changes like a typo or translation but not recommended when you may have unwanted changes in your git filesystem
# Assumes your base branch is called dev and that you want to request a review from DeedMob/engineering
# Optional step we use
npm run lint-staged
# Will prefix the branch with chore/ fix/ or feat/ as well as the commit
@davidfurlong
davidfurlong / patch.sh
Last active December 22, 2021 12:20
[See newer patch.sh] Create a PR for a small uncommitted change with one command. Assumes dev is your main branch and that you have hub installed / use github for PRs
#!/bin/bash
timestamp=$(date +%Y-%m-%d-%H-%M-%S)
read -p "When merged, this commit will: " msg
git checkout -b patch-$timestamp &&
git add ../ &&
git commit -m "$msg" &&
hub pull-request -p -m "$msg" &&
git checkout dev &&
echo "Successfully commited, opened PR for branch $msg and switched back to dev"
I am attesting that this GitHub handle davidfurlong is linked to the Tezos account tz1X1Z4g8vvYHbfdEEJ9A6LQxmbqpWQx1UVU for tzprofiles
sig:edsigtvhoMQSXE5k8aD9WyJGyiW9dh2mSzKbzuycTX668ZEGhJumhDDtS1ZPEHzG7DSASQ5rjTEm3fVg7YgGSqNjreA4Vc8HTp8
@davidfurlong
davidfurlong / RoutedTabs.js
Created June 1, 2018 10:31
Ant design + RR4 Routed Tabs
import React from 'react';
import { Tabs } from 'antd';
import PropTypes from 'prop-types';
import { withRouter } from 'react-router-dom';
const propTypes = {
history: PropTypes.any,
location: PropTypes.any,
action: PropTypes.oneOf(['push', 'replace']).isRequired,