Skip to content

Instantly share code, notes, and snippets.

View leolambertini's full-sized avatar

Leo Lambertini leolambertini

View GitHub Profile
@mattdesl
mattdesl / NFT.js
Last active March 15, 2023 04:22
pseudocode for a Non-Fungible Token smart contract (see ERC721 https://eips.ethereum.org/EIPS/eip-721)
// Global Token ID counter
Counter = 0
// Mapping from Token ID to user wallet address
Database = Map<int, address>{}
// Mint/create a NFT and assign it to a new wallet address
function CreateToken (ownerAddress) {
// Limit so that only specific addresses can query this function
// i.e. only the Artist can mint new tokens of this type
@mathisonian
mathisonian / index.md
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration