Skip to content

Instantly share code, notes, and snippets.

@nedrocks
nedrocks / use-wallet-connect-3.ts
Created April 8, 2022 21:19
Use wallet connect 3
const activateProvider = async () => {
setInternalState({
...internalState,
loading: true,
});
const web3Modal = getWeb3Modal();
try {
const provider = await web3Modal.connect();
@nedrocks
nedrocks / use-wallet-connect-2.ts
Created April 8, 2022 21:15
Use wallet connect 2
const getWeb3Modal = () => {
const providerOptions = {
injected: {
display: {
name: 'Metamask',
description: 'Connect with the provider in your Browser',
},
package: null,
},
walletconnect: {
@nedrocks
nedrocks / use-wallet-connect-1.ts
Created April 8, 2022 21:13
Wallet connect hook first section
import {
useEthers,
useLookupAddress,
} from '@usedapp/core';
import { JsonRpcProvider } from '@ethersproject/providers';
import WalletConnectProvider from '@walletconnect/web3-provider';
import Web3Modal from 'web3modal';
import { useState } from 'react';
type InternalState = {
@nedrocks
nedrocks / use-connect-wallet.ts
Created April 8, 2022 21:10
Connect wallet react hook
import {
useEthers,
useLookupAddress,
} from '@usedapp/core';
import { JsonRpcProvider } from '@ethersproject/providers';
import WalletConnectProvider from '@walletconnect/web3-provider';
import Web3Modal from 'web3modal';
import { useState } from 'react';
type InternalState = {
def sample_func():
print x
if __name__ == "__main__":
for x in range(1, 5):
sample_func()

Keybase proof

I hereby claim:

  • I am nedrocks on github.
  • I am nedrocks (https://keybase.io/nedrocks) on keybase.
  • I have a public key ASA8Mn-sM6OTL1BpPn3gXq2ecs-h5-bhWybeg9C8-s_oHQo

To claim this, I am signing this object:

@nedrocks
nedrocks / gist:d9384a536a49ccd4b915
Created February 10, 2016 20:02
Guardian/Scribe selection appears to change when logging
To show the issue, add an event listener for the scribe event in a plugin (e.g.):
scribe.el.addEventListener('keydown', function(evt) {
var lastSelection = new scribe.api.Selection();
console.log(lastSelection.range.collapsed);
console.log(lastSelection.range);
});
Now, select a block of text within the same span (1 or more characters) and type any key that modifies the state
(i.e. forces an input event to fire.) Note that the output should looks something like:
@nedrocks
nedrocks / gist:09afd6a4fa2cd472f17a
Created December 17, 2015 18:42
Bunch of FFMPEG debug stuff.
root@handler-nzdri:/tmp# cat /proc/meminfo
MemTotal: 7368688 kB
MemFree: 1444716 kB
MemAvailable: 6566060 kB
Buffers: 217740 kB
Cached: 4747756 kB
SwapCached: 0 kB
Active: 2687652 kB
Inactive: 2560684 kB
Active(anon): 285556 kB
@nedrocks
nedrocks / gist:cca7ea3cbcbcdd9fa58c
Created June 15, 2015 18:38
Shorter py2.7 emoji regex.
HASH_TAG_RE = re.compile(u"(?<!&)#(\w|(?:[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u2388\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2694\u2696\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\
@nedrocks
nedrocks / gist:b564ea29d3445f84e78f
Created June 10, 2015 21:40
Python 2.7 wide character regex
u'(?<!&)#(\w|(?:[\xAE\xA9\U00002712\U00002714\U00002716\U0000271d\U00002721\U00002728\U00002733\U00002734\U00002744\U00002747\U0000274c\U0000274e\U00002753-\U00002755\U00002757\U00002763\U00002764\U00002795-\U00002797\U000027a1\U000027b0\U000027bf\U00002934\U00002935\U00002b05-\U00002b07\U00002b1b\U00002b1c\U00002b50\U00002b55\U00003030\U0000303d\U0001f004\U0001f0cf\U0001f170\U0001f171\U0001f17e\U0001f17f\U0001f18e\U0001f191-\U0001f19a\U0001f201\U0001f202\U0001f21a\U0001f22f\U0001f232-\U0001f23a\U0001f250\U0001f251\U0001f300-\U0001f321\U0001f324-\U0001f393\U0001f396\U0001f397\U0001f399-\U0001f39b\U0001f39e-\U0001f3f0\U0001f3f3-\U0001f3f5\U0001f3f7-\U0001f4fd\U0001f4ff-\U0001f53d\U0001f549-\U0001f54e\U0001f550-\U0001f567\U0001f56f\U0001f570\U0001f573-\U0001f579\U0001f587\U0001f58a-\U0001f58d\U0001f590\U0001f595\U0001f596\U0001f5a5\U0001f5a8\U0001f5b1\U0001f5b2\U0001f5bc\U0001f5c2-\U0001f5c4\U0001f5d1-\U0001f5d3\U0001f5dc-\U0001f5de\U0001f5e1\U0001f5e3\U0001f5ef\U0001f5f3\U0001f5fa-\U0001f64f\U0001f680-\U0001f6