Skip to content

Instantly share code, notes, and snippets.

View gist:cd13d82cd808b844f99c1695aeb3974a
Current Filetype: typescript
Available Linters: ['deno', 'eslint', 'standard', 'tslint', 'tsserver', 'typecheck', 'xo']
Enabled Linters: ['eslint', 'tsserver']
Ignored Linters: []
Suggested Fixers:
'deno' - Fix TypeScript using deno fmt.
'eslint' - Apply eslint --fix to a file.
'prettier' - Apply prettier to a file.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
View 1481.dbout
Timing is on.
parent_id | resolver | count | max
-----------+--------------------------------------------+--------+----------------------------
1147078 | 0x30c9223d9e3d23e0af1073a38e0834b055bf68ed | 1 | 2020-05-05 21:11:38.870569
1147078 | 0x878bc2f3f717766ab69c0a5f9a6144931e61aed3 | 20957 | 2020-04-27 13:33:57.496785
1147078 | 0xa1cac442be6673c49f8e74ffc7c4fd746f3cbd0d | 16745 | 2020-01-02 21:54:30.164381
1147078 | 0xb66dce2da6afaaa98f2013446dbcb0f4b0ab2842 | 152837 | 2021-02-10 10:29:32.119841
1147078 | 0xef31d4eb54a743a6d665d067a374cd64cbd71ee3 | 708 | 2020-12-10 05:59:57.963046
1147078 | | 32590 | 2021-02-02 04:15:40.030202
(6 rows)
View 775.dbout
Timing is on.
operation | count | avg_gas_used | avg_gas_price | total_gas | total_price_eth | total_price_usd | ?column?
-----------------------+-------+--------------+---------------+------------+-----------------+-----------------+----------
ResolverRecordsUpdate | 10471 | 219647 | 38 | 2299920102 | 88 | 51920 | 1
BestowDomain | 10408 | 169579 | 37 | 1764980151 | 65 | 38257 | 1
GeminiBestowDomain | 401 | 174971 | 39 | 70163421 | 3 | 1604 | 1
TransferDomain | 431 | 112848 | 31 | 48637307 | 2 | 888 | 1
SetDomainResolver | 269 | 96508 | 32 | 25960760 | 1 | 495 | 1
TxpAccountFunding | 365 | 44116 | 44 | 16102417 | 1 | 457 | 1
SetChainlinkOperator | 108 |
View retryable.rb
# Retry a block, from
#
# http://blog.codefront.net/2008/01/14/retrying-code-blocks-in-ruby-on-exceptions-whatever/
#
# Options:
# * :tries - Number of retries to perform. Defaults to 1.
# * :on - The Exception on which a retry will be performed. Defaults to Exception, which retries on any Exception.
# * :interval - Number of seconds to sleep between attempts
#
# Example
View text.txt
GET /resellers/<name>/txs/messageToSign
type MetaTxMethod = 'resolveTo' | 'reconfigure' | 'setMany' | 'transferFrom';
type MetaTxParams<T extends MetaTxMethod> = {
keys: string[],
values: string[],
} | {to: string} |
Req: {
method: MetaTxMethod,
View cron.yaml
cron:
- description: email daily sales csv report
url: /cron-jobs/daily-sales-report
schedule: every day 12:00
timezone: America/Los_Angeles
- description:
remove ownership of coinbase orders if not paid / or not in time
url: /cron-jobs/pending-coinbase-orders
schedule: every 10 mins
timezone: America/Los_Angeles
View 414.dbout
Timing is on.
resolver | count
--------------------------------------------+----------
| 24833949
0xb66dce2da6afaaa98f2013446dbcb0f4b0ab2842 | 132363
0x878bc2f3f717766ab69c0a5f9a6144931e61aed3 | 21027
0xa1cac442be6673c49f8e74ffc7c4fd746f3cbd0d | 16751
0xef31d4eb54a743a6d665d067a374cd64cbd71ee3 | 704
0x30c9223d9e3d23e0af1073a38e0834b055bf68ed | 1
(6 rows)
View gist:d6ae4c947f9368fb6041447a9baf0986

Naming Service

Launch Goals

In Progress - Ability to delegate tx fee to user when claiming domains

  1. Redeploy smart contract with such functionality - done
  2. Provide backend end point to generate signatures for self-claiming - unstarted
  3. Update website UI claiming process with "Claim and pay fee" button - unstarted
View connect.ts
import {getConnectionManager, getConnection} from 'typeorm';
import {WinstonTypeormLogger} from './WinstonTypeormLogger';
import SnakeNamingStrategy from './SnakeNamingStrategy';
import config from '../config';
process.env.TZ = 'UTC';
const manager = getConnectionManager();
if (!manager.connections.length) {
View transition_validator.rb
class TransitionValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return unless record.changes[attribute]
transitions = options
start = record.send(:"#{attribute}_was")
destination = value
message = options[:message] || "can not be transitioned from #{start.inspect} to #{destination.inspect}"
allowed_transitions = transitions[start]