Skip to content

Instantly share code, notes, and snippets.

View sergeyt's full-sized avatar
:electron:
Ecclesiastes 3:1-8

Sergey Todyshev sergeyt

:electron:
Ecclesiastes 3:1-8
View GitHub Profile
@sergeyt
sergeyt / MultidiskItemList.ts
Created August 5, 2021 18:27
multidisk item list
import isEmpty from "lodash/isEmpty";
import List from "@material-ui/core/List";
import { Item, File } from "../types";
import FileItem from "./FileItem";
import FolderItem from "./FolderItem";
import Placeholder from "./Placeholder";
export default function ItemList({ data }: { data: Item[] }) {
if (isEmpty(data)) {
return (
@sergeyt
sergeyt / MultidiskUploader.ts
Created August 5, 2021 18:27
multidisk uploader
import { mutate } from "swr";
import { Widget } from "@uploadcare/react-widget";
import { Drive } from "../types";
export default function Uploader({ drive }: { drive: Drive }) {
if (drive.provider === "uploadcare") {
return (
<>
<label>Upload a file:&nbsp;</label>
<Widget
@sergeyt
sergeyt / MultidiskDriveViewPage.ts
Created August 5, 2021 18:23
multidisk drive view page
import { useRouter } from "next/router";
import useSWR from "swr";
import { Box } from "@material-ui/core";
import { getDrive } from "../../core/store";
import Loader from "../../components/Loader";
import ItemList from "../../components/ItemList";
import Uploader from "../../components/Uploader";
export default function DriveView() {
const router = useRouter();
@sergeyt
sergeyt / MultidiskDriveList.ts
Created August 5, 2021 18:18
multidisk drive list
import Link from "next/link";
import ListItem from "@material-ui/core/ListItem";
import ListItemAvatar from "@material-ui/core/ListItemAvatar";
import Avatar from "@material-ui/core/Avatar";
import { SiDropbox as DropboxIcon } from "react-icons/si";
import { FiHardDrive as DriveIcon } from "react-icons/fi";
import ListItemText from "@material-ui/core/ListItemText";
import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction";
import List from "@material-ui/core/List";
import { Drive } from "../types";
@sergeyt
sergeyt / MultidiskHomePage.ts
Created August 5, 2021 18:16
multidisk home page
import isEmpty from "lodash/isEmpty";
import useSWR from "swr";
import { getDrives } from "../core/store";
import Loader from "../components/Loader";
import Placeholder from "../components/Placeholder";
import DriveList from "../components/DriveList";
export default function Home() {
const { data: drives } = useSWR("/drives", getDrives);
if (!drives) {
@sergeyt
sergeyt / DropboxDrive.ts
Created August 5, 2021 18:14
DropboxDrive implementation
import axios from "axios";
import trimStart from "lodash/trimStart";
import { Drive, Item, File } from "../types";
import { checkResponseOK, downloadBlob, trimPrefix } from "./utils";
type Options = {
type: string;
id: string;
name: string;
accessToken: string;
@sergeyt
sergeyt / UploadcareDrive.ts
Created August 5, 2021 18:12
UploadcareDrive implementation
import axios from "axios";
import { Drive, File, Item } from "../types";
import { checkResponseOK } from "./utils";
type Options = {
type: string;
id: string;
name: string;
publicKey: string;
secretKey: string;
@sergeyt
sergeyt / multidisk-drive.ts
Created August 5, 2021 18:08
Drive abstraction
export type ItemType = "file" | "folder";
export interface Item {
type: ItemType;
id: string;
name: string;
path: string;
driveId: string;
}
@sergeyt
sergeyt / resume.json
Created January 10, 2021 05:57
SergeyT's JSON resume
{
"basics": {
"name": "Sergey Todyshev",
"label": "Programmer, simplifier, optimizer",
"summary": "I'm a software engineer with 18 years of professional experience. I have expert knowledge in C#, TypeScript and many other languages I use to develop amazing products. I am proactive doer, simplifier and optimizer. Efficiency, readability and simplicity matters for me.",
"picture": "https://avatars3.githubusercontent.com/u/190322?s=460&u=b87d4e8a9c8b452b1b96f1a6dc615865909e901f&v=4",
"email": "stodyshev@gmail.com",
"phone": "+79132017700",
"website": "https://tsvbits.com",
"profiles": [
@sergeyt
sergeyt / tcp2http.go
Created February 6, 2020 01:36
Quick HTTP to TCP workaround
package main
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"log"
"net"
"net/http"