Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alex Siman siman

🏠
Working from home
View GitHub Profile
@siman
siman / HelloOrbitDB.tsx
Last active Jul 23, 2020
Hello world example for OrbitDB
View HelloOrbitDB.tsx
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)
View multiownership.rs
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 Dec 12, 2019
Property types for Joystream versioned store codegen
View PropertyTypes.ts
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 Jan 27, 2020
Useful Linux commands for server admins (Ubuntu)
View linux-commands.md

Useful Linux Commands for Admins

Restart Subsocial docker container

docker container restart subsocial_node_alice_1

Process manager + shows CPU and RAM usage

htop

View substrate-playground.ts
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() {
View simple-pluralize.tsx
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 Sep 17, 2019
Web3 Foundation tasks for blockchain hackathon. Kyiv, Sep 21-22, 2019.
View Web3-Foundation-tasks-for-blockchain-hackathon-Kyiv-Sep-2019.md

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

  • Альтернативные реализации тех модулей (SRML), которые уже идут в составе Substrate. Например:
    • Упрощенный модуль для балансов "balances" без locking, vesting, etc.
    • Упрощенный модуль для голосования "voting" с квадратическим голосованием.
    • Альтернативная реализация модуля "treasury"
    • и т.д.
View joystream-podcast-episode-schema.json
{
"name": "PodcastEpisode",
"description": "Joystream class schema for a podcast episode",
"properties": [
{
"name": "title",
"type": "Text",
"required": true,
"maxTextLength": 100
},
@siman
siman / joystream-new-class.schema.json
Last active Sep 10, 2019
Joystream class JSON schema with example
View joystream-new-class.schema.json
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "TODO: An URL of this schema. Ideally at Joystream.org. Example: https://joystream.org/new-class.schema.json",
"title": "JoystreamNewClass",
"description": "JSON schema to describe a new class for Joystream network",
"type": "object",
"additionalProperties": false,
"required": [
"name"
],
View substrate-versioned-storage-property-array.rs
// Copyright 2019 Jsgenesis.
//
// This is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
You can’t perform that action at this time.