Skip to content

Instantly share code, notes, and snippets.

View svasva's full-sized avatar

Vitaly A. Sorokin svasva

View GitHub Profile
@svasva
svasva / x.coffee
Last active December 28, 2015 01:09
Cx.TestRoute = Ember.Route.extend
setupController: (c, m) ->
@chart_itemsChannel = pusher.subscribe("chartItems-#{pair.get 'id'}")
@chart_itemsChannel.bind 'chartItem#update', (chart_item) =>
console.log chart_item
store = @get('store')
store.push 'chartItem', chart_item
@set('store', store)
...
Cx.ChartBoxComponent = Ember.Component.extend
init: ->
groupingUnits = [
['minute',[5, 10, 15, 30]]
['hour',[1, 2, 3, 4, 6, 8, 12]]
['day',[1,2,3]]
['week',[1,2]]
['month',[1, 3, 6]]
['year',null]
]
Cx.OwnOrdersComponent = Ember.Component.extend
orders: (->
store = @get('targetObject.store')
store.find 'order',
user: @get('user').get('id')
tradePair: @get('pair').get('id')
complete: false
cancelled: false
).property()
balance: (->
@store.find('balance', {currency: @get('id')}).then (data) ->
return data.get('firstObject')
).property()
@svasva
svasva / x.coffee
Last active December 27, 2015 14:09
Cx.Router.map () ->
@route 'tradeIndex', {path: '/'}
@route 'tradePair', {path: '/trade/:urlSlug'}
Cx.TradePairRoute = Ember.Route.extend
model: (params) ->
@store.find('tradePair', {urlSlug: params.urlSlug})
# util
script_to_pubkey: (pubkey) ->
b = []
if pubkey[..1] == '04'
b.push new Buffer([0x41])
else
b.push new Buffer([0x21])
b.push util.unhexlify(pubkey)
b.push new Buffer([0xAC])
return Buffer.concat(b)
{
"account" : "",
"category" : "immature",
"amount" : 200.00000000,
"confirmations" : 17,
"blockhash" : "85432aaed4aa6836e4737197a7ff284cc4e82310d25433b4236e6c189df42bbb",
"blockindex" : 0,
"txid" : "64e59347f43b166d45948fafcd4164e16a964836ab0571f3266608df689ba533",
"time" : 1382267497
},
@svasva
svasva / node.c
Last active December 25, 2015 17:39
#include <node.h>
#include <v8.h>
#include "scrypt.h"
using namespace v8;
Handle<Value> Method(const Arguments& args) {
HandleScope scope;
String::AsciiValue value(args[0]->ToString());
char* output = (char*) malloc(32);
#include <Python.h>
#include "scrypt.h"
static PyObject *scrypt_getpowhash(PyObject *self, PyObject *args)
{
char *output;
PyObject *value;
#if PY_MAJOR_VERSION >= 3
PyBytesObject *input;
Fri Sep 06 2013 13:45:37 GMT+0000 (UTC):audit:ZET:[email protected] client balance -298745.93825382995
Fri Sep 06 2013 13:45:37 GMT+0000 (UTC):audit:ZET:[email protected] traded balance 284243.68352183
Fri Sep 06 2013 13:45:37 GMT+0000 (UTC):audit:ZET:[email protected] held balance 0.01
Fri Sep 06 2013 13:45:37 GMT+0000 (UTC):audit:ZET:[email protected] mining balance 14636.859722040015
Fri Sep 06 2013 13:45:37 GMT+0000 (UTC):audit:ZET:[email protected] current balance { balance: 134.59499004, held: 0.01 }
Fri Sep 06 2013 13:45:37 GMT+0000 (UTC):audit:ZET:[email protected] audit balance { balance: 134.59499004007193, held: 0.01 }