Skip to content

Instantly share code, notes, and snippets.

@tobiasbueschel
tobiasbueschel / gd-and-gds.md
Last active March 31, 2022 11:52
Alias: ignore package-lock.json and yarn.lock in git diff

Don't want to see package-lock.json and yarn.lock in your git diff? Here are two nifty aliases that hide these files from your diff.

alias gd="git diff -- :!package-lock.json :!yarn.lock"
alias gds="git diff --staged -- :!package-lock.json :!yarn.lock"
@lamlephamngoc
lamlephamngoc / TokenIndex.js
Last active November 13, 2018 20:37
Ledger sign txn on Ropsten Infura - Failed to subscribe to new newBlockHeaders to confirm the transaction receipts
import tiimPrivateSale from './ethereum/tiimPrivateSale';
...
submitPrivateSale = async (event) => {
event.preventDefault();
const {investor, value, bonus} = this.state;
this.closeSaleForm();
@surma
surma / README.md
Last active March 8, 2024 12:06
webpack-emscripten-wasm

Minimal example making webpack and wasm/Emscripten work together.

Build instructions:

  • Clone this gist
  • npm install
  • npm start
  • Open http://localhost:8080
  • Look at console
@gre
gre / ethereum_ledger_integration.md
Last active March 8, 2022 05:41
Quick Guide for Ethereum Ledger Integration

How to integrate the Ledger device with a Ethereum Web Application

This is a quick guide to show how to integrate Ledger Ethereum libraries into an existing web application.

If you are starting a new DApp project from scratch, or simply are beginning in this Ethereum Smart Contract world, we have made create-dapp Starter Kit for you, it comes with a out-of-the-box support of Ledger and MetaMask and shows a complete smart contract example (that allows to get/set a value globally).

Whether you want to integrate on an existing app or bootstrap it from scratch with our starter kit, the follow guide will drive you to important part on how things work with the Ledger.

Prerequisites of the guide

@goloroden
goloroden / app.js
Last active June 22, 2023 02:10
Async constructors for JavaScript
// In JavaScript, constructors can only be synchronous right now. This makes sense
// from the point of view that a constructor is a function that returns a newly
// initialized object.
//
// On the other hand, it would sometimes be very handy, if one could have async
// constructors, e.g. when a class represents a database connection, and it is
// desired to establish the connection when you create a new instance.
//
// I know that there have been discussions on this on StackOverflow & co., but
// the so-far mentioned counter arguments (such as: doesn't work as expected
@sogoiii
sogoiii / ListenToEventsWeb3-1-0-0-beta.js
Last active December 26, 2023 23:00
Listening to Solidity events using web3 1.0.0 beta
const Web3 = require('web3') // Works with web3 1.0.0-beta27
const contractArtifact = require('./build/contracts/TutorialToken.json')
const web3 = new Web3()
const providerUrl = 'ws://localhost:8545' // requires # https://github.com/trufflesuite/ganache-cli/releases/tag/v7.0.0-beta.0 or https://github.com/trufflesuite/ganache/releases/tag/v1.1.0-beta.0
const provider = new Web3.providers.WebsocketProvider(providerUrl)
web3.setProvider(provider)
web3.eth.net.getId()
.then(networkId => {
@VictorTaelin
VictorTaelin / upload_json_to_ipfs.js
Last active December 30, 2021 20:09
Upload a JSON to IPFS
const ipfs = require("nano-ipfs-store").at("https://ipfs.infura.io:5001");
(async () => {
const doc = JSON.stringify({
foo: "bar",
tic: "tac"
});
const cid = await ipfs.add(doc);
@emschwartz
emschwartz / README.md
Last active September 28, 2019 11:28
1st ETH -> XRP Interledger Escrow Payment

1st ETH -> XRP Interledger Escrow Payment

Here are the transaction IDs (and links to the block explorers) for the first livenet Ethereum and Ripple Consensus Ledger (RCL) escrowed transfers comprising an Interledger payment.

  1. Ethereum prepare: 0x00cbb6149b9cfb3cedf280251c3060b2a38776fa7792b578b6f9f39ce5ee0266
  2. RCL prepare: 7F0A5F16C84568D96DA6A66058CD9EAA881236237642BF7427A458957A752B6B
  3. RCL fulfill: 12A4CAFAE95254844513C5C11488A1195C08DEFF673C97AC74AAC121935DDE36
  4. Ethereum fulfill: 0xb59dd839ab0b5e7d4e663b7cfc0ddb70eaf73dd2785b3d3a4abdf1a61817007d

SHA-256 Condition: `d2

@jcavat
jcavat / Dockerfile
Last active February 25, 2024 13:58
docker-compose with php/mysql/phpmyadmin/apache
FROM php:7.1.2-apache
RUN docker-php-ext-install mysqli
@tomconte
tomconte / compile-deploy-sign.js
Created January 3, 2017 14:25
Shows how to compile and deploy a Smart Contract using client-side transaction signature, i.e. does not require the account to be unlocked in the Ethereum node.
const fs = require('fs');
const solc = require('solc');
const Web3 = require('web3');
const Tx = require('ethereumjs-tx')
// Private key to use to sign the transactions
// To decrypt your private key, use e.g. https://www.myetherwallet.com/#view-wallet-info
// You will find your private key file in e.g. .ethereum/keystore or .parity/keys
// In this example the key should correspond to the web3.eth.coinbase address
var privateKey = new Buffer('088c110b6861b6c6c57461370d661301b29a7570d59cb83c6b4f19ec4b47f642', 'hex')