This file contains 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
Header: | |
Header { parent_hash: 0x8933e679f6ec2f4ec831fdc856949483a5cd2f97b3092af61d1360c0ad56d10c, number: 3234675, state_root: 0x9395fe4ba2caf22d04c998492d083f2bc78b0355f7450d3cf03f4fa113464f1c, extrinsics_root: 0x68fe4fb0482a7af39b18d68f92f90c13edfc000e7878c7aa2cae1289bbce78f9, digest: Digest { logs: [DigestItem::PreRuntime([66, 65, 66, 69], [2, 1, 0, 0, 0, 81, 90, 160, 19, 0, 0, 0, 0]), DigestItem::Consensus([102, 114, 111, 110], [1, 26, 47, 127, 198, 167, 108, 138, 212, 3, 22, 129, 235, 44, 69, 155, 119, 55, 171, 124, 207, 219, 238, 190, 17, 213, 117, 214, 167, 56, 173, 42, 15, 4, 164, 24, 50, 229, 201, 233, 190, 118, 82, 223, 169, 58, 57, 173, 239, 215, 111, 6, 41, 120, 67, 188, 157, 124, 144, 128, 169, 142, 61, 180, 132, 254]), DigestItem::Seal([66, 65, 66, 69], [122, 250, 192, 111, 59, 137, 103, 110, 254, 167, 180, 48, 80, 23, 123, 150, 8, 255, 196, 182, 136, 155, 227, 111, 132, 119, 38, 14, 249, 208, 104, 81, 80, 233, 176, 131, 157, 96, 172, 221, 64, 77, 59, 127, 184, 144, 160, 94, 237, 211, 198, 213, |
This file contains 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
const { ApiPromise, WsProvider } = require('@polkadot/api'); | |
const { Keyring } = require('@polkadot/keyring'); | |
const { | |
construct, | |
decode, | |
deriveAddress, | |
getRegistry, | |
methods, | |
PolkadotSS58Format, | |
} = require('@substrate/txwrapper-polkadot'); |
This file contains 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
use std::io; | |
use std::sync::{Arc, RwLock}; | |
use casbin::{Enforcer, FileAdapter, Model, RbacApi}; | |
use actix_web::{middleware, web, App, HttpRequest, HttpResponse, HttpServer}; | |
/// simple handle | |
async fn index(enforcer: web::Data<RwLock<Enforcer<FileAdapter>>>, req: HttpRequest) -> HttpResponse { | |
println!("{:?}", req); | |
assert_eq!(vec!["data1_admin"], enforcer.write().unwrap().get_roles_for_user("alice")); |
This file contains 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
#[macro_use] | |
extern crate downcast_rs; | |
use downcast_rs::DowncastSync; | |
use std::any::{Any, TypeId}; | |
use std::collections::HashMap; | |
pub trait Resolvable { | |
fn resolve<T: Injectable>(&self) -> Option<&T>; | |
// TODO: use impl Injectable or Box<dyn Injectable>? |
This file contains 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
"cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-m64" "-nostdlib" "/home/joey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o" "/home/joey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o" "-L" "/home/joey/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "/home/joey/github/vector/target/x86_64-unknown-linux-musl/debug/deps/vector-041044fb0a65e4a1.10003g8tm9m9a9re.rcgu.o" "/home/joey/github/vector/target/x86_64-unknown-linux-musl/debug/deps/vector-041044fb0a65e4a1.1065etxaeawt1v5k.rcgu.o" "/home/joey/github/vector/target/x86_64-unknown-linux-musl/debug/deps/vector-041044fb0a65e4a1.128pf4ngj1mre226.rcgu.o" "/home/joey/github/vector/target/x86_64-unknown-linux-musl/debug/deps/vector-041044fb0a65e4a1.13m875uyi4ea1d9f.rcgu.o" "/home/joey/github/vector/target/x86_64-unknown-linux-musl/debug/deps/vector-041044fb0a65e4a1.1587nu0lntfrin53.rcgu.o" "/hom |
This file contains 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
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Http; | |
using TodoApi.Services; | |
namespace TodoApi.Middlewares | |
{ | |
public class AuthzMiddleware | |
{ | |
private readonly RequestDelegate _next; |
This file contains 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
# generic tree in python | |
# to demostrate a category tree | |
class Tree: | |
def __init__(self): | |
self.roots = [] | |
def add_root(self, val): | |
node = Node(val) | |
self.roots.append(node) |
This file contains 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
function on(event: string, listener: Function) { | |
console.log('on event: ', event, 'typeof listener:', typeof (listener)); | |
listener(); | |
} | |
function on1(event: string, listener: (...args: any[]) => void) { | |
console.log('on event: ', event, 'typeof listener:', typeof (listener)); | |
listener(); | |
} |
This file contains 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
struct List { | |
head: Link, | |
} | |
type Link = Option<Box<Node>>; | |
struct Node { | |
elem: i32, | |
next: Link, | |
} |
This file contains 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
<?php | |
use Amp\Http\Server\RequestHandler\CallableRequestHandler; | |
use Amp\Http\Server\Server; | |
use Amp\Http\Server\Request; | |
use Amp\Http\Server\Response; | |
use Amp\Http\Status; | |
use Amp\Socket; | |
use Symfony\Component\HttpFoundation\Request as SymfonyRequest; | |
use Symfony\Component\HttpFoundation\File\UploadedFile; |
NewerOlder