Skip to content

Instantly share code, notes, and snippets.

View siman's full-sized avatar
🏠
Working from home

Alex Siman siman

🏠
Working from home
View GitHub Profile
{
"todo-tree.tree.showScanModeButton": false,
"enableTelemetry": false,
"editor.fontSize": 14,
"editor.tabSize": 2,
"workbench.iconTheme": "vscode-great-icons",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"files.associations": {
"*.css": "scss"
export type AsyncHookResult<R = void> = {
loading?: boolean
error?: Error
result?: R // TODO require R if loading is true
}
export function newAsyncHookLoading<R = void> (loading = true): AsyncHookResult<R> {
return { loading }
}
@siman
siman / HelloOrbitDB.tsx
Last active July 23, 2020 10:14
Hello world example for OrbitDB
import { useEffect, useState } from 'react'
const IpfsClient = require('ipfs-http-client')
const OrbitDB = require('orbit-db')
const ipfs = IpfsClient('/ip4/127.0.0.1/tcp/5001')
// Your identity id can be retrieved with:
// console.log(db.identity.id)
use rstd::prelude::*;
use support::{decl_module, decl_storage, decl_event, StorageValue, StorageMap, ensure, dispatch::Result, Parameter};
use parity_codec::{Encode, Decode, Codec};
use runtime_primitives::traits::{As, Member, SimpleArithmetic, MaybeDebug, MaybeSerializeDebug};
use rstd::collections::btree_map::BTreeMap;
use {timestamp};
use system::{self, ensure_signed};
pub const MIN_SPACE_OWNERS: u16 = 1;
pub const MAX_SPACE_OWNERS: u16 = u16::MAX;
@siman
siman / PropertyTypes.ts
Created December 12, 2019 13:35
Property types for Joystream versioned store codegen
abstract class BaseProperty {
public type: string;
public name: string;
public description?: string;
public required?: boolean = false;
}
export class PrimitiveProperty extends BaseProperty {}
export class VecProperty extends BaseProperty {
@siman
siman / linux-commands.md
Last active January 27, 2020 11:29
Useful Linux commands for server admins (Ubuntu)

Useful Linux Commands for Admins

Restart Subsocial docker container

docker container restart subsocial_node_alice_1

Process manager + shows CPU and RAM usage

htop

import { Substrate } from "../cli/substrate";
import { arrayToOneLineString, prettyClass, prettyEntity } from '../cli/printers';
import { AddClassSchemaInputType } from '../types/AddClassSchemaTypes';
const classId = 1
const entityId = 1
const schemaId = 0
// tslint:disable-next-line:max-func-body-length
async function main() {
function pluralize(count: number | BN, singluarText: string, plularText?: string) {
count = typeof count !== 'number' ? count.toNumber() : count;
const plural = () => !plularText ? singluarText + 's' : singluarText;
const text = count === 1 ? singluarText : plural()
return <><b>{count}</b> {text}</>
}
@siman
siman / Web3-Foundation-tasks-for-blockchain-hackathon-Kyiv-Sep-2019.md
Created September 17, 2019 08:25
Web3 Foundation tasks for blockchain hackathon. Kyiv, Sep 21-22, 2019.

Вознаграждение от Web3 Foundation в размере $500 получит команд(а/ы), которая предложит качественное решение на блокчейне фреймворке Substrate или же, если это решение связано с инфраструктурой Polkadot Network. В качестве примеров, могут быть проекты на такую тему:

  • Альтернативные реализации тех модулей (SRML), которые уже идут в составе Substrate. Например:
    • Упрощенный модуль для балансов "balances" без locking, vesting, etc.
    • Упрощенный модуль для голосования "voting" с квадратическим голосованием.
    • Альтернативная реализация модуля "treasury"
    • и т.д.
{
"name": "PodcastEpisode",
"description": "Joystream class schema for a podcast episode",
"properties": [
{
"name": "title",
"type": "Text",
"required": true,
"maxTextLength": 100
},