Skip to content

Instantly share code, notes, and snippets.

🐉
!

kumavis kumavis

🐉
!
Block or report user

Report or block kumavis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:d6a1e0ce435478e27383
# Ethereum Browser - MIST Analogue
============== WHAT ============
### Goals:
(1) Identity Management
(2) Wallet App
(3) Contract Browser
(4) Dapp runtime environment
@kumavis
kumavis / gist:220699f0fc5d52e2cfc4
Last active Aug 29, 2015
Example of es6 transpile
View gist:220699f0fc5d52e2cfc4
var koa = require('koa');
var app = koa();
// logger
app.use(function *(next){
var start = new Date;
yield next;
var ms = new Date - start;
console.log('%s %s - %s', this.method, this.url, ms);
View gist:19fb4f6bd25b19ba9083
function* addGenerator() {
var i = 0;
while (true) {
i += yield i;
}
}
var adder = addGenerator();
adder.next().value; // 0
adder.next(5).value; // 5
View gist:45f45cfc3b6cffa8088a
std=["top", "window", "location", "external", "chrome", "document", "define", "global", "cr", "ntp", "templateData", "Handler", "i18nTemplate"];Object.keys(window).filter(function(item){return std.indexOf(item)===-1})
View gist:0f51963d03f6ea3ef5b7
nm = NumberMachine()
nm.multiply(2)
nm.add(6)
nm.subtract(3)
nm.multiply(2)
nm(10) //=> 46
nm(0) //=> 6
nm(20) //=> 86
@kumavis
kumavis / gist:c654143c4bcdea21e618
Last active Aug 29, 2015
How to Mercury (kumavis style)
View gist:c654143c4bcdea21e618

First define your component:

  • value types and defaults for each key
  • 'channels', actions that potentially modify state or perform i/o. triggered by button presses, mouse movements, etc
var Value = require('observ')
var Component = require('../lib/component.js')
var Wallet = require('../wallet/index.js')
var Identity = require('../identity/index.js')
var render = require('./render.js')
View gist:2bb0e66a32958ce0612f
10:46 <kumavis> maybe components could have some generic channel-generating hooks ?
10:46 <kumavis> render() { return inputBox( state.label, state.channels.bindValue('label') ) }
10:47 <kumavis> which could simplify to inputBox( state, 'label' )
10:47 <kumavis> so i dont have to create a channel that only updates a value directly passed in
10:48 <kumavis> right now i have to do inputBox(state.newIdentityAddress, state.channels.updateNewIdentityAddress)
10:48 <kumavis> function updateNewIdentityAddress(state, data) {
10:48 <kumavis> state.newIdentityAddress.set(data.text)
10:48 <kumavis> }
10:48 <kumavis> its just a lot of code to do one simple thing i feel
10:56 ⇐ alexandergugel quit (~alexander@208.66.27.18) Remote host closed the connection
View gist:02d4ecaa6d375cbdd22d
╭─{👘 } kumavis in ~/Development/Node/ethereum-address-generator
╰─± node example.js
Looking for an address starting with "abc".
tried 1000 identities.
tried 2000 identities.
tried 3000 identities.
tried 4000 identities.
tried 5000 identities.
tried 6000 identities.
Found after 6110 attempts!
View harlem-shake.js
;(function () {
function c() {
var e = document.createElement("link");
e.setAttribute("type", "text/css");
e.setAttribute("rel", "stylesheet");
e.setAttribute("href", f);
e.setAttribute("class", l);
document.body.appendChild(e)
}
function h() {
View gist:2a34b865c8ef504f722b
start (secret) -> return apiObject with [encrypt, decrypt] with plaintext secret stored in closure
encrypt (input) -> generate salt, iv, additionalData, -> generate hash from salt and secret -> generate key from hash -> encrypt with key -> return json string with salt, iv, additionalData, and encrypted data (edited)
decrypt(input) -> read salt, iv, additionalData -> generate hash from salt and secret -> generate key from hash -> decrypt with key -> return unecrypted data
and the 'encrypted text' includes plaintext metadata about the encryption settings (salt, iv, additionalData)
You can’t perform that action at this time.