Skip to content

Instantly share code, notes, and snippets.

View davidfurlong's full-sized avatar
👨‍💻

David Furlong davidfurlong

👨‍💻
View GitHub Profile
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 / 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
I am attesting that this GitHub handle davidfurlong is linked to the Tezos account tz1X1Z4g8vvYHbfdEEJ9A6LQxmbqpWQx1UVU for tzprofiles
sig:edsigtvhoMQSXE5k8aD9WyJGyiW9dh2mSzKbzuycTX668ZEGhJumhDDtS1ZPEHzG7DSASQ5rjTEm3fVg7YgGSqNjreA4Vc8HTp8
@davidfurlong
davidfurlong / Extract first number in google sheets from a cell formula
Created January 4, 2021 15:59
extracts first continuous number from a cell in google sheets. Examples "abc 30,00" => 30, "fsdf 10 fsdf 20" => 10 "abc12fee" => 12, "abc 30.0" => 30
// Replace K2:K with your column letter and 2 with the row number of the current row. You only need to insert this into one cell in the column.
=ARRAYFORMULA(IF(ISERROR(regexextract(K2:K,"[0-9]+")), "", regexextract(K2:K,"[0-9]+")))
@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"
@davidfurlong
davidfurlong / Postgres heroku dump restore in local
Created March 8, 2019 09:35
Restoring a production heroku postgres backup into a local postgres instance on OSX
0. Make sure your Postgres version is the same as the heroku one (even minor version)
1. Download heroku backup
2. Add .dump extension to the file
3. Run
$ pg_restore -f mydatabase.sql mydatabase.dump
to convert sql dump to sql.
4. Find the 'Owner' name in the file and replace all with your localhost Owner (find by using \l and finding the owner of local database's Name)
5. psql databasename
6. \i mydatabasedump.sql
@davidfurlong
davidfurlong / ScrollToTop.js
Last active June 1, 2018 10:33
React router 4 scroll to top behaviour, with support for tabs and/or case by case scrolling
// ScrollToTop.js
import React from 'react';
import { withRouter } from 'react-router-dom';
class ScrollToTop extends React.Component {
componentDidUpdate(prevProps) {
if (prevProps.location && this.props.location !== prevProps.location &&
!(this.props.location.state && this.props.location.state.resetScroll === false)) {
window.scrollTo(0, 0);
}