Skip to content

Instantly share code, notes, and snippets.

View amdev9's full-sized avatar
🌎

Alexander Matveev amdev9

🌎
View GitHub Profile
@amdev9
amdev9 / async-defer-module.md
Created October 4, 2022 18:19 — forked from jakub-g/async-defer-module.md
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@amdev9
amdev9 / machine-learning.md
Created June 20, 2019 13:15 — forked from obenjiro/machine-learning.md
Самый мягкий и пушистый путь в Machine Learning
@amdev9
amdev9 / signTransaction.js
Last active December 25, 2018 12:13
web3
/*
web3.eth.accounts.signTransaction({
to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
value: '1000000000',
gas: 2000000,
gasPrice: '234567897654321',
nonce: 0,
chainId: 1
}, '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318')
.then(console.log);
var Web3 = require('web3');
const EthereumTx = require('ethereumjs-tx');
const ethUtil = require('ethereumjs-util');
const rlp = require('rlp');
var txDecoder = require('ethereum-tx-decoder');
let flag = false;
let buffer;
const API_KEY = 'https://ropsten.infura.io/v3/YOUR_INFURA_KEY';