Skip to content

Instantly share code, notes, and snippets.

💭
Developing the future

Kristijan Sedlak xpepermint

💭
Developing the future
View GitHub Profile
View Function accepts struct or function pointer
// Parameter that each resolver accepts.
pub struct Intent {}
// Resolver definition.
pub trait Resolver {
fn resolve(&self, intent: Intent) -> Result<usize, usize>;
}
impl<F: Fn(Intent) -> Result<usize, usize>> Resolver for F {
fn resolve(&self, intent: Intent) -> Result<usize, usize> {
self(intent)
View xcert-certification-example-for-ethereum.js
const { Cert } = require('@0xcert/cert');
const { HttpProvider } = require('@0xcert/ethereum-http-provider');
const { AssetLedger } = require('@0xcert/ethereum-asset-ledger');
(async () => {
const schema = {
"$schema": "http://json-schema.org/draft-07/schema",
"description": "A digital assets that have a unique combination of different properties.",
"properties": {
View gist:2ce1d9aaa134db8fed1b90c87292a373
```
docker run -d \
--name geth-test \
-p 8545:8545 \
-v ~/.docker/machine/volumes/geth-test/data:/root/.ethereum \
ethereum/client-go \
--testnet \
--rpc \
--rpcaddr "0.0.0.0" \
--rpccorsdomain "*" \
@xpepermint
xpepermint / nuxt.config.js
Created Nov 25, 2018
Fix for: [nuxt] Error while initializing app ReferenceError: exports is not defined
View nuxt.config.js
export default {
build: {
extend(config, { isDev }) {
if (isDev) config.resolve.symlinks = false
},
},
}
View .travis.yml
---
language: node_js
node_js:
- 9
- 10
script:
# use latest npm to work on node9
- npm install -g npm
# codecov
- npm install -g codecov
@xpepermint
xpepermint / README.md
Last active Nov 3, 2018
RushJS cheatsheet
View README.md

Commands

Install dependencies:

npm install -g @microsoft/rush

Initialize the project:

@xpepermint
xpepermint / index.ts
Created Aug 13, 2018
Merkle tree implementation
View index.ts
/**
* Converts a list of values into a list of pairs.
* @param arr Single dimensional array of values.
*/
function toPairs(arr) {
return Array.from(Array(Math.ceil(arr.length / 2)), (_, i) => arr.slice(i * 2, i * 2 + 2));
}
/**
* Converts a list of values into a list of pairs.
@xpepermint
xpepermint / Command
Created Jul 19, 2018
MongoDB setup using Docker
View Command
docker run -d \
--name mongo \
-p 27017:27017 \
-v ~/.docker/machine/volumes/mongo/4/data:/data/db \
mongo:4
@xpepermint
xpepermint / facts.md
Last active Apr 3, 2018
0xcert protocol specification
View facts.md

Whitepaper: https://0xcert.org/whitepaper.pdf

Non-fungible Token

  • A unique, one-of-a-kind asset.
  • A digital asset like a collectible, a document or a thing.
  • Follows ERC721 specification.

Xcert

@xpepermint
xpepermint / index.js
Created Sep 30, 2017
Using RawModel in ExpressJS actions.
View index.js
const { Model } = require("rawmodel");
const express = require("express");
/** Application context *******************************************************/
class Context {
constructor() {
this.db; // imaginary database
}
connect() {
You can’t perform that action at this time.