Skip to content

Instantly share code, notes, and snippets.

View raineorshine's full-sized avatar

Raine Revere raineorshine

  • New York, NY
View GitHub Profile
npm rebuild leveldown scrypt;
echo "Starting Testrpc..."
./node_modules/ethereumjs-testrpc/bin/testrpc --port 8545 --account "0xb21e287e6dcb34cf16abb6ce71f7209906c13f763c6415c6b2320eea7688212f, 10000000000000000000000000" --account "0x3ba8150286625233d3154d795527e3cbbc07a135d14392e9485f08d2d555fb3d, 10000000000000000000000000" &
testrpc_pid=$!
sleep 5;
karma start config.karma.js
echo "Shutting down TestRpc..."
kill -9 $testrpc_pid
./node_modules/.bin/electron-rebuild;
> npm-check-updates@2.14.2 test /Users/raine/projects/npm-check-updates
> npm run lint ; mocha && mocha test/individual
> npm-check-updates@2.14.2 lint /Users/raine/projects/npm-check-updates
> eslint bin lib test
npm-check-updates
@raineorshine
raineorshine / accumulate.js
Created November 9, 2017 00:09
accumulate(): Executes an array of promises or promise-returning functions serially and reduces the results with the given accumulator
const waterfall = require('promise.waterfall')
const Bluebird = require('bluebird')
const _ = require('lodash')
// an array of 10ms functions with different return values
const functions = [
() => Bluebird.delay(10, 'a'),
() => Bluebird.delay(10, 'b'),
() => Bluebird.delay(10, 'c')
]
@raineorshine
raineorshine / commit-author.sh
Created October 12, 2017 17:09
Set git commit author for a single repository
git config user.name "ShapeShift-Public"
git config user.email "mail@hshapeshift.io"
https://help.github.com/articles/setting-your-username-in-git/#setting-your-git-username-for-a-single-repository

Keybase proof

I hereby claim:

  • I am raineorshine on github.
  • I am raineorshine (https://keybase.io/raineorshine) on keybase.
  • I have a public key ASDmUNgDNwUm5tB0gK8u8hFbHKsUKuFSXHhQjg889aByeQo

To claim this, I am signing this object:

@raineorshine
raineorshine / sendRawTransaction.js
Last active December 3, 2022 18:02
Sends a raw transaction with web3 v1.2.2, ethereumjs-tx v2.1.1, and Infura
const Web3 = require('web3')
const Tx = require('ethereumjs-tx').Transaction
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privateKey = new Buffer('PRIVATE_KEY', 'hex')
@raineorshine
raineorshine / rinkeby-faucet
Created August 23, 2017 16:32
Rinkeby Faucet
0x26c3103d96a7c87698e87f5bf2db2ac8152997ff
contract MyContract {
User user;
mapping (address => User) public users;
uint40 time; // cast to 5 bytes - packed with user
address addr1; // 20 bytes - packed with time
address addr2; // 20 bytes - unpacked, one slot
struct User {
@raineorshine
raineorshine / get-contract-array-values.js
Created April 9, 2017 17:34
A generic means of getting all values from a public contract array.
// Streams all values from a public contract array. Callback is a function that takes a single
// argument, one item from the array. Returns a promise that rejects if there is any error or
// resolves if all items have been retrieved.
function getAll(contract, sizeGetter, array, cb) {
// get the size of the array
return contract[sizeGetter]().then(n => {
// generate an array of contract calls
return Promise.all(Array(n.toNumber()).fill().map(i => {
// invoke the callback with the item
return contract[array](i).then(cb)