Skip to content

Instantly share code, notes, and snippets.

View bertolo1988's full-sized avatar
🎯
Focusing

Tiago Bértolo bertolo1988

🎯
Focusing
View GitHub Profile
@bertolo1988
bertolo1988 / wallet-address-signature-demo.js
Created March 17, 2023 11:45
Verify ethereum wallet ownership remotely.
/**
First install and run ganache.
> npm install ganache --global
> execute this code https://gist.github.com/bertolo1988/096d436f072d2513eb4ff1cd83201c47
**/
const Web3EthAccounts = require('web3-eth-accounts');
const PORT = 61063;
@bertolo1988
bertolo1988 / eip-1193-provider.js
Created March 17, 2023 11:44
Launches an EIP-1193 provider locally.
const ganache = require('ganache');
const options = {};
const server = ganache.server(options);
const PORT = 0; // 0 means any available port
server.listen(PORT, async (err) => {
if (err) throw err;
console.log(`ganache listening on port ${server.address().port}...`);
});
Method name clone is callable typeof is function enumerable properties name prototype constructor clone is independent
cloneJSON
structuredClone
underscoreContribClone
cloneNemisj
cloneTrincot
cloneKoolDandy
cloneRfdc
justClone
cloneDeep
Method name should clone an object with circular reference to an element of the array
cloneJSON
structuredClone
underscoreContribClone
cloneNemisj
cloneTrincot
cloneKoolDandy
cloneRfdc
justClone
cloneDeep
Method name __proto__ by referencing clones the __proto__ non enumerable properties in the prototype
cloneJSON
structuredClone
underscoreContribClone
cloneNemisj
cloneTrincot
cloneKoolDandy
cloneRfdc
justClone
cloneDeep
Method name frozen sealed non extensible
cloneJSON
structuredClone
underscoreContribClone
cloneNemisj
cloneTrincot
cloneKoolDandy
cloneRfdc
justClone
cloneDeep
Method name getter setter enumerable non enumerable enumerable and writable non enumerable non writable and configurable non enumerable writable and non configurable non enumerable non writable and non configurable own symbol
cloneJSON
structuredClone
underscoreContribClone
cloneNemisj
cloneTrincot
cloneKoolDandy
cloneRfdc
justClone
cloneDeep
Method name shallow object non shallow object circular references typeof constructor
cloneJSON
structuredClone
underscoreContribClone
cloneNemisj
cloneTrincot
cloneKoolDandy
cloneRfdc
justClone
cloneDeep
Method name string number boolean undefined null Symbol BigInt
cloneJSON
structuredClone
underscoreContribClone
cloneNemisj
cloneTrincot
cloneKoolDandy
cloneRfdc
justClone
cloneDeep
@bertolo1988
bertolo1988 / how-to-clone-prototype-by-copying.js
Last active October 12, 2022 09:20
How to clone a javascript object without just referencing the prototype.
// How to clone a javascript object without just referencing the prototype
const assert = require('node:assert')
const input = { a: 1 }
// every prototype is an object with normal property descriptors
const prototypeDescriptors = Object.getOwnPropertyDescriptors(
Object.getPrototypeOf(input)
)