Skip to content

Instantly share code, notes, and snippets.

View zurgl's full-sized avatar
🪐
Working from home

zurgl zurgl

🪐
Working from home
View GitHub Profile
const axios = require("axios");
require("dotenv").config();
const main = async () => {
const addr = "12VpUFS23SePmovN9PXjXn6yRprUCXUG5YVbfYJoTY9MsDNw";
const api = axios.create({
baseURL: process.env.TX_SEARCH_URL,
headers: {
"Content-Type": "application/json",
},
@zurgl
zurgl / tuto.md
Last active June 7, 2021 11:18
figment-tuto

Building a polkadot's transaction viewer

Objectives

  • Learn how to extract revelant information from blockchain using figment api.
  • Learn how to display them to the end-user with the aid of a web-apps.
  • Gain insight in polkadot transaction's logics

Project set up

@zurgl
zurgl / hooks.md
Created June 8, 2021 09:49
Hooks snippets

here

useEffect( () => console.log("mount"), [] );
useEffect( () => console.log("will update data1"), [ data1 ] );
useEffect( () => console.log("will update any") );
useEffect( () => () => console.log("will update data1 or unmount"), [ data1 ] );
useEffect( () => () => console.log("unmount"), [] );
@zurgl
zurgl / async_tips.md
Last active June 9, 2021 03:17
async await tips

here

Standardize error handling

async function awesome() {
    try {
        const data = await promise;
        return [data, null]
    } catch(error) {
 console.error(error)
@zurgl
zurgl / mint.js
Created July 3, 2021 01:19
solana js examples
const web3 = require('@solana/web3.js');
const splToken = require('@solana/spl-token');
(async () => {
//create connection to devnet
const connection = new web3.Connection(web3.clusterApiUrl("devnet"));
//generate keypair and airdrop 1000000000 Lamports (1 SOL)
const myKeypair = web3.Keypair.generate();
@zurgl
zurgl / push_issue.md
Created July 6, 2021 00:36
git push issue

To push a cloned repo when two factor is enable

git remote -v
git remote remove origin
git remote add origin git@github.com:zurgl/example-helloworld.git 
git push --set-upstraem origin Update-to-keypair

to restore a file

@zurgl
zurgl / near-js.md
Created July 12, 2021 15:29
some near stuff
const { connect, keyStores } = require("near-api-js");
const path = require("path");
const homedir = require("os").homedir();
const nacl = require("tweetnacl");
const sha256 = require("js-sha256");

const ACCOUNT_ID = "near-example.testnet";
const CREDENTIALS_DIR = ".near-credentials";
@zurgl
zurgl / friendly_explanation.md
Last active July 19, 2021 17:54
example of educational content

How would a DAO administrating the bridge work? I have to be honest, I'm a bit lost on this - as most web2 devs are, how would you explain in the simplest terms? as if i was the typical learner going through this curriculum

Younger, I remember my first solo road trip. When I've bought my first car, I thought I was definitly a freeman. Just put some gas in the tank, and any land trip was possible.

Once, far away I saw an amazing stuff: Normandy Bridge. "The perfect spot to take some selfies and boild up my socials networks" I thought. Unfortunatly at the entry, I've realized: this bridge is a tolled road for car, and I let my credit card at home.

@zurgl
zurgl / polygon-hover.tsx
Created August 17, 2021 11:20
polygon-hover.tsx
import styled from "styled-components"
const primaryColor = "#966ae0"
const secondaryColor = "#F6F6F6"
const PolygonLogo = () =>
<PolygonSVG x="0px" y="0px" viewBox="0 0 38.4 33.5" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M29,10.2c-0.7-0.4-1.6-0.4-2.4,0L21,13.5l-3.8,2.1l-5.5,3.3c-0.7,0.4-1.6,0.4-2.4,0L5,16.3
c-0.7-0.4-1.2-1.2-1.2-2.1v-5c0-0.8,0.4-1.6,1.2-2.1l4.3-2.5c0.7-0.4,1.6-0.4,2.4,0L16,7.2c0.7,0.4,1.2,1.2,1.2,2.1v3.3l3.8-2.2V7
c0-0.8-0.4-1.6-1.2-2.1l-8-4.7c-0.7-0.4-1.6-0.4-2.4,0L1.2,5C0.4,5.4,0,6.2,0,7v9.4c0,0.8,0.4,1.6,1.2,2.1l8.1,4.7