Commands
Install dependencies:
npm install -g @microsoft/rush
Initialize the project:
1. Build GraphQL server using `express-graphql` package. | |
2. Configure `schema.js` file. | |
3. Query for data. |
var path = require('path'); | |
var webpack = require('webpack'); | |
var isProduction = process.env.NODE_ENV === 'production'; | |
/* | |
* Compile for usage in a browser-like environmen or for the server. | |
*/ | |
exports.target = 'web'; |
use std::fs::File; | |
use std::io::Read; | |
fn main() { | |
let mut f = File::open("/dev/urandom").unwrap(); // from Linux | |
let mut buf = [0u8; 16]; | |
f.read_exact(&mut buf).unwrap(); | |
println!("{:?}", buf); | |
} |
Install dependencies:
npm install -g @microsoft/rush
Initialize the project:
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": { |
use std::ops; | |
#[derive(Debug, Default, Clone, Copy, Eq, Hash, PartialEq, PartialOrd, Ord)] | |
pub struct U32(u32); | |
impl ops::Add for U32 { | |
type Output = Self; | |
fn add(self, rhs: Self) -> Self { | |
Self(self.0 + rhs.0) | |
} |
```rs | |
// Based on: https://www.reddit.com/r/rust/comments/ehr8ct/announcing_impls_a_macro_to_determine_if_a_type/ | |
// trait for T | |
trait TTrate { | |
const VALUE: bool = false; | |
} | |
impl<T> TTrate for T {} | |
// custom trait |
'use strict'; | |
/** | |
* Webpack Configuration File | |
* | |
* This is a configuration file for Webpack module bundler. You should customize | |
* it to fit your project. | |
* | |
* To start the development server run: | |
* |
// 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) |
``` | |
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 "*" \ |