Created
October 16, 2017 20:15
-
-
Save askucher/99bf510a38e45000f50ac84b54dfbf66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //code.jquery.com/jquery-3.2.1.min.js | |
| //ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js | |
| //__my_subdomain.flyber.net/cdn/flyber-angular.js | |
| //cdn.rawgit.com/MikeMcl/bignumber.js/master/bignumber.min.js | |
| //cdnjs.cloudflare.com/ajax/libs/ng-grid/2.0.11/ng-grid.min.js | |
| //cdnjs.cloudflare.com/ajax/libs/ngStorage/0.3.6/ngStorage.min.js | |
| //cdn.zingchart.com/zingchart.min.js | |
| //cdn.zingchart.com/angular/zingchart-angularjs.js | |
| //maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css | |
| //cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css | |
| //bootswatch.com/sandstone/bootstrap.css | |
| //cdn.rawgit.com/haggen/2624063/raw/9f0f72e62145538c32f726793b7303c3e820f3c1/proxima-nova.css | |
| //cdnjs.cloudflare.com/ajax/libs/ng-grid/2.0.11/ng-grid.css |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| head | |
| body(ng:app='app' ng:controller='traffic') | |
| h4 Contributions Stats | |
| fieldset | |
| label Stats | |
| table.transactions | |
| tr | |
| td Total Registrations | |
| td {{myData.length}} | |
| tr | |
| td Total Registrations without assigned ETH addresses | |
| td {{stats.withoutAddresses}} | |
| tr | |
| td Total Contributed | |
| td {{stats.totalContributed}} ETH | |
| h4 Contribution Chart | |
| zingchart(id="myChart" zc-json="chartJson" zc-height="500" zc-width="100%") | |
| h4 Contribution Details | |
| .search | |
| input(ng:model="gridOptions.filterOptions.filterText" placeholder="Search") | |
| .gridStyle(ng-grid="gridOptions") | |
| button(ng:click="exportEmails()") Export Emails | |
| div(ng:if="mySelections.length > 0") | |
| h2 Addresses of {{mySelections[0].email}} | |
| table.transactions | |
| tr | |
| td BTC address | |
| td | |
| a(href="https://blockchain.info/address/{{ mySelections[0].btcaddress }}") {{ mySelections[0].btcaddress }} | |
| tr | |
| td ETH address | |
| td | |
| a(href="https://etherscan.io/address/{{ mySelections[0].ethaddress }}") {{ mySelections[0].ethaddress }} | |
| h4 Transactions of {{mySelections[0].email}} | |
| table.transactions | |
| tr(ng:repeat="selection in mySelections[0].txs") | |
| td | |
| a(target="blank" href="{{selection.url}}") {{selection.url}} | |
| td {{selection.date}} | |
| td {{selection.assigned}} | |
| td {{selection.token}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| angular | |
| .module \app, [\flyber, \ngStorage, \ngGrid, \zingchart-angularjs ] | |
| .filter \cut, -> | |
| (text, num)-> | |
| if text.length > num then text.substr(0, num) + \... else text | |
| .filter \showeth, -> | |
| (value)-> | |
| | value.index-of(\0x) is 0 => value | |
| | _ => "" | |
| .filter \usd, -> | |
| (value)-> | |
| new BigNumber(value).times(300).to-string! | |
| .controller \traffic , ($scope, flyber) -> | |
| export export-emails = -> | |
| state = { data: "data:text/csv;charset=utf-8," } | |
| data = my-data.map(-> [it.email]) | |
| data.forEach (infoArray, index) !-> | |
| line = infoArray.join(",") | |
| state.data += if index < data.length then line + "\n" else line | |
| encodedUri = encodeURI(state.data) | |
| window.open(encodedUri) | |
| export my-data = [] | |
| export chartJson = | |
| type : 'line' | |
| series : [] | |
| export my-selections = [] | |
| export grid-options = | |
| data: \myData | |
| filter-options: | |
| filterText: '' | |
| maintainColumnRatios: \100px | |
| selected-items: my-selections | |
| enableRowSelection: yes | |
| enableRowReordering: yes | |
| enableHighlighting: yes | |
| multiSelect: false | |
| enableColumnResize: yes | |
| showFooter: yes | |
| showGroupPanel: yes | |
| groups: [\hastx] | |
| column-defs: | |
| * { field: 'address', displayName: "ETH Address (to obtain tokens)", width: 320 } | |
| * { field: 'contrib', displayName: 'Balance (In ETH)', width: 200 } | |
| * { field: 'types', displayName: "Contrib in Coins", width: 120 } | |
| * { field: 'email', displayName: "Email (Changeable)" } | |
| * { field: 'reference', headerCellClass: 'ageHeader', displayName: "Traffic Source", width: 200 } | |
| * { field: 'start', displayName: "Registered Date", } | |
| * { field: 'ip', displayName: 'Registered IP', width: 100 } | |
| * { field: 'name', displayName: 'Name', width: 50 } | |
| * { field: 'hastx', displayName: 'Has TX', width: 30 } | |
| # http://ip-api.com/json/208.80.152.201 | |
| export stats = | |
| without-addresses: 0 | |
| total-contributed: 0 | |
| limit = (row)-> | |
| {address, email, reference, start, ip, name, transaction, contrib} = row | |
| actual-address = if address.index-of(\@) > -1 then '' else address | |
| hastx = if transaction?length > 0 then "Has Txs" else 'Not Txs' | |
| types = if transaction?length > 0 then transaction.map(-> it.token).join(';') else "" | |
| txs = transaction | |
| {address: actual-address, email, reference, start, ip, name, hastx, txs, btcaddress: row[\btc-address], ethaddress: row[\eth-address], contrib, types} | |
| flyber | |
| .get \contributors/Lydian | |
| .then (resp)-> | |
| push = (item)-> | |
| my-data.push item | |
| resp.data.filter(-> it.amount isnt "0").map(limit).for-each push | |
| stats.without-addresses = resp.data.filter(-> it.address.index-of(\@) > -1).length | |
| chartJson.series.push {values: my-data.map(-> parse-int it.contrib).filter(-> it > 0) } | |
| sum = (x, y)-> x + y | |
| stats.totalContributed = chartJson.series.0.values.reduce sum, 0 | |
| $scope <<< out$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body | |
| padding: 10px | |
| .gridStyle | |
| border: 1px solid rgb(212,212,212) | |
| width: 100% | |
| height: 500px | |
| .search | |
| padding-bottom: 10px | |
| .transactions | |
| td | |
| border: 1px solid #CCC | |
| padding: 3px |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment