Skip to content

Instantly share code, notes, and snippets.

View industral's full-sized avatar
:octocat:

Alex Ivasyuv industral

:octocat:
  • Ukraine, Lviv
View GitHub Profile
@font-face {
font-family: KaTeX_AMS;
src: url(/static/fonts/KaTeX_AMS-Regular.e78e28b.woff2) format("woff2"), url(/static/fonts/KaTeX_AMS-Regular.7f06b4e.woff) format("woff"), url(/static/fonts/KaTeX_AMS-Regular.aaf4eee.ttf) format("truetype");
font-weight: 400;
font-style: normal
}
@font-face {
font-family: KaTeX_Caligraphic;
src: url(/static/fonts/KaTeX_Caligraphic-Bold.4ec58be.woff2) format("woff2"), url(/static/fonts/KaTeX_Caligraphic-Bold.1e802ca.woff) format("woff"), url(/static/fonts/KaTeX_Caligraphic-Bold.021dd4d.ttf) format("truetype");
[
{
"constant": false,
"inputs": [
{
"name": "newMessage",
"type": "string"
}
],
"name": "setMessage",
const fs = require('fs');
const ganache = require('ganache-cli');
const Web3 = require('web3');
const solc = require('solc');
const web3 = new Web3(ganache.provider());
(async function() {
const input = {
pragma solidity ^0.5.8;
contract Inbox {
string public message;
constructor(string memory initialMessage) public {
message = initialMessage;
}
function setMessage(string memory newMessage) public {
@industral
industral / gist:0aa368b8a5348613b07c3e27ff9bfdec
Created May 2, 2019 15:00
web3@1.0.0-beta.50 deploy contract error
Error: Transaction has been reverted by the EVM:
{
"transactionHash": "0x87c2b0e842ff22aed985a5cfdb95f9ac09b090de1b2f02f74c0c376f0027a976",
"transactionIndex": 0,
"blockHash": "0xb2f5e0e0c0f3560b3c27e51765833d547b149069e79bf4610659c2408a638d8c",
"blockNumber": 1,
"from": "0xee701ca561a711b218589aac4827e04c7e5a3c0f",
"to": null,
"gasUsed": 299853,
"cumulativeGasUsed": 299853,
@industral
industral / flattering.js
Last active January 10, 2018 08:01
Array flattering
var array = [[['a','b','c'],[1,2,3]],[],[['d','e','f','g','h'],[4,5,6,7]]]
function flat(data) {
return data.reduce((r, e) => r.concat(Array.isArray(e) ? flat(e) : e), [])
}
console.log(flat(array))
@industral
industral / JavaScript_Closure_Example.js
Created December 31, 2014 07:04
JavaScript Closure Example
window.x = 1; // will controll external variable
(function() {
var a = window.x / 2; // lexical scope, evaluate within external variable
var b = window.x * 2;
window.AAA = function A() {
console.log(a + b); // use lexical variables
}
@industral
industral / ObjectSize.js
Created December 12, 2014 13:34
Object size
var o = {x: 1}
Object.defineProperty(o, "length", { get: function () { return Object.keys(this).length; } });
o.length
@industral
industral / bash.sh
Last active August 29, 2015 14:04
BASH advanced usage
mkdir -p p/{1,2,3,4}
touch p/{1,2,3,4}/{package.json,README.md}
rm p/*/package.json