Skip to content

Instantly share code, notes, and snippets.

View Gozala's full-sized avatar
😱
Oh well

Irakli Gozalishvili Gozala

😱
Oh well
View GitHub Profile
@Gozala
Gozala / unixfs.ts
Created January 31, 2022 19:59
Attempt to define more clearly unixfs encoding
import type { CID } from 'multiformats'
/**
* Logical representation of a raw chunk of a file.
*
* TODO: Clarify when represenation is used instead of `FileChunk`
* representation.
*/
export interface Raw extends PBNode {
Data: ByteView<{
@Gozala
Gozala / api.v0.ts
Last active January 6, 2022 06:42
Sketch of unixfs-importer API
import type { CID} from "multiformats"
import { Mtime } from "ipfs-unixfs"
export interface Lib {
/**
* Creates a directory importer that can be used to build up directory of
* files. It takes an optional queuing strategy parameter that can be used
* to specify how how many blocks can be queue internally before backpressure
* is applied and writer is blocked. This allows users to specify how much
import { loop, recur } from './loop.js'
export const factorial = (n) => loop((n, acc) => n <= 1 ? acc : recur(n - 1, n * acc), n, 1)
/**
* @template T, X, A
* @typedef {import('./protocol').Process<T, X, A>} Process
*/
/**
* @template X, T
* @typedef {import('./protocol').Task<X, T>} Task
*/
interface CID {
code: number
version: number
multihash: Uint8Array
bytes: Uint8Array
}
type Future<T> =
| T
| Promise<T>
@Gozala
Gozala / Readme.md
Created April 2, 2020 19:08
Reproducible test case

This is illustrating issue with vscode

use async_std::task;
use juniper::{EmptyMutation, RootNode};
struct Concrete;
enum CustomName {
Concrete(Concrete),
}
#[juniper::graphql_object]
type Tag {
id:ID
name: String! @fake(type:word)
}
type InlineLink {
id:ID
to:Resource!
name:String @examples(values: ["automerge", "pushpin", "local-first", "farm"])
description:String @fake(type:words)
@Gozala
Gozala / hypermerge.ts
Created February 20, 2020 07:25
Attempt to revist hypermerge interface
type DocID<a> = string
type Doc<a> = a
interface RepoService {
keys: KeyService
create<a>(doc: Doc<a>): Promise<DocID<a>>
read<a>(id: DocID<a>): Promise<a>
change<a>(id: DocID<a>, change: (doc: a) => void): Promise<void>
watch<a>(id: DocID<a>): AsyncIterator<a>
diff --git a/toolkit/components/extensions/ExtensionProtocol.jsm b/toolkit/components/extensions/ExtensionProtocol.jsm
new file mode 100644
index 000000000000..723bc3c77f6c
--- /dev/null
+++ b/toolkit/components/extensions/ExtensionProtocol.jsm
@@ -0,0 +1,964 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+"use strict"