Skip to content

Instantly share code, notes, and snippets.

View rcaloras's full-sized avatar
🔷
Stay hungry. Stay Foolish.

Ryan Caloras rcaloras

🔷
Stay hungry. Stay Foolish.
View GitHub Profile
@rcaloras
rcaloras / opensea-refresh-metadata.js
Created January 6, 2023 20:42
Opensea metadata refresh script. For chains that aren't supported via API.
// Paste this script into the console on a specfic NFT detail page for your collection.
// e.g. https://opensea.io/assets/ethereum/0x1485297e942ce64e0870ece60179dfda34b4c625/3723
// Adjust i on the for loop for the range of nfts you wish to refresh
// Should work for all chains including Polygon and testnets.
// Returns a Promise that resolves after "ms" Milliseconds
const timer = ms => new Promise(res => setTimeout(res, ms))
async function refresh_metadata() { // We need to wrap the loop into an async function for this to work
for (var i = 1; i <= 1326; i++) {
class BinaryTreeNode {
BinaryTreeNode left;
BinaryTreeNode right;
int value;
}
public static BinaryTreeNode findInorderSuccessor(BinaryTreeNode root, int value) {
if (root == null) {
throw new IllegalArgumentException("Root cannot be null");
}
@rcaloras
rcaloras / uuidToMongoCollection.js
Last active June 9, 2022 11:22
Add JUUID to every Mongo document that doesn't contain one
// Guid generator function based on stackoverflow
// http://stackoverflow.com/a/2117523/1282124
function guid(){
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}