Skip to content

Instantly share code, notes, and snippets.

View wbobeirne's full-sized avatar

Will O'Beirne wbobeirne

View GitHub Profile
{
"timestamp": "2019-01-12T17:20:27.670Z",
"main": {
"customNetworks": [],
"customTokens": [],
"customDeriviationPaths": [],
"gas": {
"speed": "regular"
},
"skipTutorial": true
/*
Check the token balances of a wallet for multiple tokens.
Pass 0x0 as a "token" address to get ETH balance.
Possible error throws:
- extremely large arrays for user and or tokens (gas cost too high)
Returns a one-dimensional that's user.length * tokens.length long. The
array is ordered by all of the 0th users token balances, then the 1th
user, and so on.
Verifying my Blockstack ID is secured with the address 1MuzNQ5ecsjWt3yAz6CrPbKZtkzLhHbHQo https://explorer.blockstack.org/address/1MuzNQ5ecsjWt3yAz6CrPbKZtkzLhHbHQo
Verifying my Blockstack ID is secured with the address 16Zk2WG5cBc7Lrq9yMLLbt8BujCJbjNBFm https://explorer.blockstack.org/address/16Zk2WG5cBc7Lrq9yMLLbt8BujCJbjNBFm

When starting a new project with a Postgres database, you'll want to do the following things to set it up:

1) Create the Database

Depending on which operating system you're on, you'll need to do the following:

OSX

  1. Open your terminal
  2. Run psql --username=postgres, enter the password you made for postgres
@wbobeirne
wbobeirne / gist:b38ddb50a64626112eec13d82508a43d
Created January 11, 2018 23:10
Kovan Faucet Verification
0xdbbf1a39bf68a269ce4fe6fd24299afb94df86e6

_.map

Pretty much identical IMO.

// Lodash
const listOfAttrs = _.map(listOfObjects, (obj) => obj.attr);

// JS
const listOfAttrs = listOfObjects.map((obj) => obj.attr);
const fs = require("fs");
module.exports = (args) => {
return (data) => {
let json = null;
// Include the JSON, throw a log and exit if it wasn't JSON / bad path.
try {
json = require(args.path);
if (!json || json.constructor != Object) {
# Provides functions that help with scrolling
# -----------------------------------------------------------------------------
Ok.ScrollHelpers = {
# Check if an element has a scrollbar.
checkScroll: (element, dir) ->
if dir == 'horizontal'
# Half pixels on innerWidth get rounded down. Better way to handle this?
return element.prop('scrollWidth') > (element.innerWidth() + 1)
else
return element.prop('scrollHeight') > element.innerHeight()
<?php
/**
* Copy the data from one field to another, and delete the old field.
*/
function merge_fields($old_field, $new_field, $entity_type = '', $bundle = '') {
$prefixes = array(
'field_data_',
'field_revision_',
);