Skip to content

Instantly share code, notes, and snippets.

@circlespainter
circlespainter / enable.js
Last active October 27, 2019 19:08
Metamask DSA
if (window.ethereum) {
window.web3 = new Web3(ethereum)
try {
// Request account access if needed
await ethereum.enable()
} catch (error) {
console.log(error)
}
}
Flux.concat(dao.findIds() // ADDED: Flux.concat
.doOnNext { id: String ->
LOGGER.info { "[findIds] $id" }
}
.map { id: String -> // WAS: flatMap
dao.getDocById(id)
.doOnSubscribe {
LOGGER.info { "before getDocById: $id" }
}.doOnSuccess {
LOGGER.info { "after getDocById: $it" }
dao.findIds()
.doOnNext { id: String ->
LOGGER.info { "[findIds] $id" }
}
.flatMap { id: String ->
dao.getDocById(id)
.doOnSubscribe {
LOGGER.info { "before getDocById: $id" }
}.doOnSuccess {
LOGGER.info { "after getDocById: $it" }
@circlespainter
circlespainter / neural_weights_count.py
Created November 12, 2016 08:43
neural_weights_count.py
import sys
# From http://stackoverflow.com/a/1988826/3756789
class Memoize:
def __init__(self, f):
self.f = f
self.memo = {}
def __call__(self, *args):