Skip to content

Instantly share code, notes, and snippets.

@danfinlay
danfinlay / index.js
Created October 27, 2016 02:34
requirebin sketch
var firstAngle = 0.05
var distance = 20
var secondAngle = 0.12
var master = document.querySelector('body')
var Raphael = require('raphael')
var diameter = 100
var origin = diameter/2
@danfinlay
danfinlay / pre-push.sh
Created October 20, 2016 17:37
pre git push linting script. Goes in .git/hooks/pre-push
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
@danfinlay
danfinlay / poloniex_prices.json
Created October 20, 2016 00:46
Sample poloniex price api response
{
"BTC_1CR": {
"id": 1,
"last": "0.00821571",
"lowestAsk": "0.00839804",
"highestBid": "0.00817041",
"percentChange": "0.04102408",
"baseVolume": "113.28330000",
"quoteVolume": "13484.59993656",
"isFrozen": "0",
@danfinlay
danfinlay / background.js
Created September 13, 2016 22:37
adding popup open flag
const urlUtil = require('url')
const extend = require('xtend')
const Dnode = require('dnode')
const eos = require('end-of-stream')
const PortStream = require('./lib/port-stream.js')
const notification = require('./lib/notifications.js')
const messageManager = require('./lib/message-manager')
const setupMultiplex = require('./lib/stream-utils.js').setupMultiplex
const MetamaskController = require('./metamask-controller')
const extension = require('./lib/extension')
@danfinlay
danfinlay / dapp-data.md
Created September 6, 2016 22:41
Dapp directory

Each dapp should provide:

  • Web URL
  • A logo graphic (minimum ~200px square, multiple sizes TBD)
  • Contract address (or addresses, both mainnet and testnet)
@danfinlay
danfinlay / keybase.md
Created July 15, 2016 06:36
keybase.md

Keybase proof

I hereby claim:

  • I am flyswatter on github.
  • I am danfinlay (https://keybase.io/danfinlay) on keybase.
  • I have a public key whose fingerprint is 75E9 EF17 C8DD 1EAC CE2B 3F1F 9311 02F2 4B36 007A

To claim this, I am signing this object:

@danfinlay
danfinlay / mock_notification.js
Last active March 14, 2017 09:30
A simple metamask notification code example.
var state = {
imageifyIdenticons: false,
txData: {
"id":1467868023090690,"txParams":{"data":"0xa9059cbb0000000000000000000000008deb4d106090c3eb8f1950f727e87c4f884fb06f0000000000000000000000000000000000000000000000000000000000000064","from":"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825","value":"0x16345785d8a0000","to":"0xbeb0ed3034c4155f3d16a64a5c5e7c8d4ea9e9c9","origin":"MetaMask","metamaskId":1467868023090690,"metamaskNetworkId":"2"},"time":1467868023090,"status":"unconfirmed","containsDelegateCall":false
},
accounts: {
'0xfdea65c8e26263f6d9a1b5de9555d2931a33b825': {
balance: "0x15e578bd8e9c8000",
}
},
@danfinlay
danfinlay / index.js
Created June 28, 2016 17:45
requirebin sketch
var jazzicon = require('jazzicon')
var body = document.querySelector('body')
var container = document.createElement('div')
container.style.height = '100%'
container.style.overflowY = 'scroll'
container.style.position = 'fixed'
body.appendChild(container)
@danfinlay
danfinlay / index.js
Created June 28, 2016 17:40
requirebin sketch
var jazzicon = require('jazzicon')
var h = require('virtual-dom/virtual-hyperscript/svg')
var createElement = require('virtual-dom/create-element')
var body = document.querySelector('body')
for(var i = 0; i < 10; i++) {
var fakeAccount = '0x'
for (var x = 0; x < 10; x++) {
fakeAccount += Math.round(Math.random() * 10)
@danfinlay
danfinlay / index.js
Created June 21, 2016 00:55
requirebin sketch
var jazzicon = require('jazzicon')
var h = require('virtual-dom/virtual-hyperscript/svg')
var createElement = require('virtual-dom/create-element')
var body = document.querySelector('body')
for(var i = 0; i < 10; i++) {
var fakeAccount = '0x'
for (var x = 0; x < 10; x++) {
fakeAccount += Math.round(Math.random() * 10)