Skip to content

Instantly share code, notes, and snippets.

View briangershon's full-sized avatar

Brian Gershon briangershon

View GitHub Profile
@briangershon
briangershon / readme.md
Created December 20, 2023 22:56
How to link directly to an unsplash.com image (via Unsplash API)
  1. Search for photo by viewing on unsplash.com and finding ID in URL. For example https://unsplash.com/photos/photo-of-green-leafed-plants-QKo-op_gR9I which has ID QKo-op_gR9I
  2. Grab your access key from Unsplash API dashboard: ACCESS_KEY_GOES_HERE
  3. Grab JSON file by plugging in ID and client_id into API so URL looks like this: https://api.unsplash.com/photos/QKo-op_gR9I?client_id=ACCESS_KEY_GOES_HERE
  4. Pull out the regular size URL from the JSON in "urls > regular" key (which is 1080 wide) and use that in the site
@briangershon
briangershon / requirements.md
Last active March 23, 2023 16:50
Developer DAO Academy Feature: Highlight Content Authors and Reviewers. Link to Peeranha forum.

Goals

  • Primarily highlight content author. Inlude a PFP image, name, organization name and a link to their personal site.
  • Secondarily highlight all reviewers and contributors
  • Link to a specific topic on Peeranha forum so users can ask questions and have discussions. For example Lesson 4: Testing your TierNFT would point to Testing Solidity contracts topic in Peeranha.

Other goals:

  • Create a consistent header and footer to use for all content tracks and fundamentals
  • Add a general link to our Peeranha community in Footer and Getting Started - https://developerdao.peeranha.io
@briangershon
briangershon / SETUP.md
Created August 12, 2022 20:19
Local Setup to Verify Git Commits via GPG. Plus import GitHub public key.

Local setup to verify your Git Commits

Follow instructions here: https://gist.github.com/Beneboe/3183a8a9eb53439dbee07c90b344c77e

Import GitHub webflow key

When you merge commits via GitHub UI (say "squash and merge"), GitHub will sign the commit itself.

Import GitHub webflow key so key is verified when you run git log --show-signature

@briangershon
briangershon / encrypt-and-transfer.md
Created May 28, 2022 02:44
Encrypt files to send via https://transfer.sh (or other services)

These worked for me locally:

encrypt:

cat tshirt.png | openssl enc -aes-256-cbc -a -salt -p > test.enc

decrypt:

cat test.enc | openssl aes-256-cbc -d -a -out tshirt2.png
@briangershon
briangershon / solana-anchor-debug-rust.md
Created February 28, 2022 06:47
Solana Anchor: Test and Debug Rust with msg! and program-logs

What if you want to debug the Rust program itself in Anchor?

  1. In Rust, add msg!("Some variable: {:?}", variable);
  2. Run anchor test to run the program through the tests. However you won't find the output there.
  3. View the output instead in a file within your program-logs folder in your Anchor project. It'll be recreated each time you run the program.

This is subtly mentioned in the docs and can be found in the CLI docs here: https://book.anchor-lang.com/chapter_4/cli.html#test

@briangershon
briangershon / README.md
Last active January 28, 2022 04:57
vscode solidity plugin settings so linting works (when using a non-standard location)

The https://github.com/Developer-DAO/pixel-avatars project has a non-standard place for the contracts so the OpenZeppelin imports are shown with a red lint error.

For Solidity VSCode plugin, set "Package Default Dependencies Directory" to contract/node_modules instead of default node_modules.

VSCode can then find the OpenZeppelin imports.

@briangershon
briangershon / main.css
Created February 18, 2021 06:04
font-family css defaults that look nice across browsers and operating systems
html {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
.code {
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
Bitstream Vera Sans Mono, Courier New, monospace;
}
@briangershon
briangershon / gist:cfa5c1ba0e8938eaf85c7ea9a7945c37
Created January 31, 2021 23:26
TypeScript interface for React click event
interface Props {
clickOnSuccess: (
event: React.MouseEvent<HTMLButtonElement>,
url: string
) => void;
}
@briangershon
briangershon / README.md
Last active July 29, 2024 02:32
Minecraft Plugin Development Guide

Minecraft Plugin Development Guide

For those new to Minecraft Plugins, there's a lot of new and old documentation to run through on the web.

Additionally plugins compiled on newer versions of Java weren't working on older stable Minecraft server versions.

I've captured my learning in two places:

  • This guide covers the workflow of editing, compiling and testing plugins.

Karaoke Session at Rockbox - July 2021

  • In The Navy - Village People
  • Beauty School Dropout Grease
  • Raspberry Beret - Prince
  • It Ain't My Fault - Brothers Osborne
  • Soul Man - Sam & Dave
  • Invisible Sun - The Police
  • Let's Go - The Cars
  • Tenth Avenue Freeze Out - Bruce Springsteen