Skip to content

Instantly share code, notes, and snippets.

View xavierlepretre's full-sized avatar
🤯

Xavier Leprêtre xavierlepretre

🤯
View GitHub Profile
@xavierlepretre
xavierlepretre / getAccountsPromise.js
Created July 19, 2016 11:22
Get the Promise of Web3 accounts
web3.eth.getAccountsPromise = function () {
return new Promise(function (resolve, reject) {
web3.eth.getAccounts(function (e, accounts) {
if (e != null) {
reject(e);
} else {
resolve(accounts);
}
});
});
@xavierlepretre
xavierlepretre / getTransactionReceiptMined.js
Last active February 5, 2023 03:26
Get the Promise of an Ethereum transaction receipt when it is finally mined
const Promise = require("bluebird");
const sequentialPromise = require("./sequentialPromise.js");
/**
* @param {!string | !Array.<!string>} txHash, a transaction hash or an array of transaction hashes.
* @param {Number} interval, in seconds.
* @returns {!Promise.<!object> | !Promise.<!Array.<!object>>} the receipt or an array of receipts.
*/
module.exports = function getTransactionReceiptMined(txHash, interval) {
const self = this;
@xavierlepretre
xavierlepretre / keybase.md
Created January 23, 2016 15:38
Keybase.io proof of ownership

Keybase proof

I hereby claim:

  • I am xavierlepretre on github.
  • I am xavierlepretre (https://keybase.io/xavierlepretre) on keybase.
  • I have a public key whose fingerprint is A75D D98D B756 36FA AFE8 2BDD 78C5 1285 AAC6 B231

To claim this, I am signing this object:

@xavierlepretre
xavierlepretre / IsConnectedTestRule.java
Created November 14, 2015 17:03
"Assume Android is connected". Runs the individual test if the Android device is connected to the network, in an Espresso test environment.
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.test.InstrumentationRegistry;
import org.junit.Assume;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;