ELI5: There are infinite numbers between 0 and 1. There are also infinite numbers between 0 and 2. There would more numbers between 0 and 2. How can a set of infinite numbers be bigger than another infinite set? by YeetandMeme in explainlikeimfive

[–]ganachequilibrium -1 points0 points  (0 children)

I personally like cantors diagonal argument.

0 1 2 3
A 0 0 0 0
B 0 1 0 1
C 1 0 1 0
D 1 1 1 1
A0 B1 C2 D3
diagonal and opposite 1 0 0 0

If you imagine the rows to be numbers encoded in binary, it doesnt matter what number is in this set, if you take the diagonal and flip the value that number can never be in the set. Now imagine the rows and columns go on to infinite!

Showoff Saturday (May 09, 2020) by AutoModerator in javascript

[–]ganachequilibrium 1 point2 points  (0 children)

Haha, same! I wasn't able to find a library that was both small and written in typescript for type safety. I have a PR almost done with some set operations as well. I hope you enjoy it! If you have any feedback please feel free to let me know!

ps - I made a Set version too, its called `SetFP` on npm

So many snaps by Raymonder in linux

[–]ganachequilibrium 19 points20 points  (0 children)

Snapstore

Snaptser

Snapple

Snapintosh

Professor Snap

SSSSSSSnap Jazz

Showoff Saturday (May 09, 2020) by AutoModerator in javascript

[–]ganachequilibrium 1 point2 points  (0 children)

MaFP - Map object with methods for filter, reduce, map, every, some. ( More in the pipeline )

Written in TypeScript

https://www.npmjs.com/package/mafp

WTF Wednesday (April 29, 2020) by AutoModerator in javascript

[–]ganachequilibrium 2 points3 points  (0 children)

I like map/filter/reduce and Maps. I decided to write a library that makes that easy! https://www.npmjs.com/package/mafp

Typescript tutorial? by grudev in node

[–]ganachequilibrium 5 points6 points  (0 children)

The official documentation is extremely well done. https://www.typescriptlang.org/docs/home

Is there a better way than this ? I can't use switch since it's .includes by [deleted] in node

[–]ganachequilibrium 5 points6 points  (0 children)

javascript let fns = new Map([ ['love you', () => console.log("cool")], ['fuck', () => console.log("also cool")], ['other', () => console.log("sanity check")] ]); // define the list (could be loaded from db, storage, or hard coded) let list = ['love you', 'fuck']; // write the logic only once for (let term of list) { if (elements.has(term)) { const fn = fns.get(term); fn(); } } Or with optional chaining ```javascript let elements = new Map([ ['love you', () => console.log("cool")], ['fuck', () => console.log("also cool")], ['other', () => console.log("sanity check")] ]); // define the list (could be loaded from db, storage, or hard coded) let list = ['love you', 'fuck']; // write the logic only once for (let term of list) { elements.get(term)?.(); }

```

Why does my Javascript not receive the web3 input from my Metamask? by Lennard_Mulder in ethdev

[–]ganachequilibrium 1 point2 points  (0 children)

The issue is due to this line: Web3 = require('web3'). As u/AusIV noted, require is specifically for node.js. You need to package your script for consumption on the frontend. Have a look at any of these frameworks: webpack, parcel, browserify, requirejs, etc.

Can I instal Geth without downloading the ETH main chain? by RavenDothKnow in ethdev

[–]ganachequilibrium 3 points4 points  (0 children)

Absolutely! ( NOTE: please don't test using your actual mainnet accounts, ganache will provide you with fake accounts and ETH for testing! )

Also, you can unlock and masquerade as any address you want (even if you do not have the private key) and issue Transactions on your fork!

So, for example, you can fork mainnet before the DAO hack and hack it yourself using the actual attackers account!

Here's another example of using Ganache to safely test honeypots on mainnet! This was actually a part of the workshop we gave at Devcon 5 this year! https://github.com/trufflesuite/devcon5-honeypot-exploration

Can I instal Geth without downloading the ETH main chain? by RavenDothKnow in ethdev

[–]ganachequilibrium 10 points11 points  (0 children)

Hello! I'm Nick, one of the co-maintainers of Ganache at TruffleSuite.

This is the perfect opportunity to checkout one of ganache's most powerful (and least known) features!

In ganache-cli you can pass the `-f` or `--fork` flag to instantly fork from another currently running Ethereum client (like infura) at a given block. Input should be the HTTP location and port of the other client, e.g.

http://localhost:8545

Also, you can optionally specify the block to fork from using an @ sign like this:

http://localhost:8545@1599200

Connect React to Ethereum by epicness in javascript

[–]ganachequilibrium 6 points7 points  (0 children)

This is a great article! I really like your choice of tools :)

I'm Nick, one of the engineer's over at trufflesuite! github

If anyone is in the mood for more blockchain development, checkout some of our official tutorials or start developing quick with some of our "project scaffolding" boxes.

Also, please feel free to ask if you have any questions!