Skip to content

Instantly share code, notes, and snippets.

View myyellowshoe's full-sized avatar

Justin myyellowshoe

View GitHub Profile
@myyellowshoe
myyellowshoe / nftImageTransform.ts
Last active August 28, 2023 20:28
Solana NFT Image Transform
import * as functions from "firebase-functions";
import { ShadowFile, ShdwDrive } from "@shadow-drive/sdk";
import { Wallet } from "@project-serum/anchor";
import { Metaplex } from "@metaplex-foundation/js";
import jimp from "jimp";
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
const secretKey = Uint8Array.from(process.env.SHADOW_KEY as Iterable<number>);
@myyellowshoe
myyellowshoe / printEdition.ts
Last active June 27, 2023 14:30
Calculating NFT Print Edition Supply Manually
/*
Print editions are awesome but tricky, 2 big issues:
1. Printing in quick succession.
Multiple people click a button to print at the same time, same edition will try and get printed multiple times.
2. Burned nfts mess up on chain supply reference.
We can solve for number #2, and drastically reduce #1 window for any errors.
This is largely a port of the code here:
https://github.com/samuelvanderwaal/metaboss/blob/b662001ee929f5b34f3660c227136aab9697de27/src/mint.rs#L366
@myyellowshoe
myyellowshoe / AutoScalingSvgSolution.md
Last active July 1, 2024 14:05
Auto Scaling Svg Solution

Autoscaling SVG's

Scaling svgs is annoying and most solutions require tradoffs I don't want. I'm suprised the ammount of solutions out there that are pretty subpar or require extra overhead.

What I don't want:

  • use an image tag
  • use wrappers
  • use weird padding
  • pass down props for width/height or viewBox props.
@myyellowshoe
myyellowshoe / react-cheat-sheet.md
Last active June 8, 2020 20:25
React Cheat Sheet

React Cheat Sheet

A high level overview of react components for quick reference. The react docs are awesome, but wanted to make an even more distilled version. May leave some things out for simplicity. Assumes your using react 16.8+.

Component Types

  • React.Component() Class
    • Use this in most cases.
    • Deep compare of props/state
  • React.PureComponent() Class
@myyellowshoe
myyellowshoe / PurdySetup.MD
Last active July 18, 2019 18:43
A light walkthrough of adding eslint-airbnb and prettier to a create react app.

Use the follwing steps to setup and use eslint and prettier in a create react app. I've seperated out the eslint and prettier setup so you can see whats needed for both.

1. Create app

npx create-react-app purdier

2. Install eslint deps

npm i -D eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks
app.get('/', (req, res) => {
const client = new Client();
client.connect()
.then(() => {
const sticky = await client.query("SELECT * FROM product_index WHERE product_sticky::boolean = 'true'")
.then((results) => results.rows);
const lowstock = await client.query("SELECT * FROM product_index WHERE product_sticky::boolean = 'true'");
.then((results) => results.rows);
return { sticky, lowstock };
{
"codes": [2000, 2314, 4539, 3947, 1001, 329984]
}
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
INSERT INTO "features"("id","name","description","icon","position","slug","estimated_hours_for_mobile_app","estimated_hours_for_web_app","is_public","created_at","updated_at") VALUES (1,E'Messaging',E'Message other users',E'stuff',1,E'messaging',1,1,TRUE,E'2013-09-24 00:00:00',E'2013-09-24 00:00:00'), (4,E'GPS',E'Location based services',NULL,2,E'gps',NULL,NULL,TRUE,E'2015-10-26 16:56:43.889252',E'2015-10-26 16:56:43.889252'), (5,E'API',E'Integrate with another site like Facebook or Dropbox',NULL,3,E'api',NULL,NULL,TRUE,E'2015-10-26 16:56:43.967036',E'2015-10-26 16:56:43.967036'), (6,E'Multiple User Types',E'Certain users can do certain things',NULL,4,E'multiple-user-types',NULL,NULL,TRUE,E'2015-10-26 16:56:43.998404',E'2015-10-26 16:56:43.998404'), (7,E'Geolocation',E'See items on a map, find something based on location',NULL,5,E'geolocation',NULL,NULL,TRUE,E'2015-10-26 16:56:44.027216',E'2015-10-26 16:56:44.027216'), (8,E'Search',E'Search by keyword, apply filters',NULL,6,E'search',NULL,NULL,TRUE,E'2015-10-