Skip to content

Instantly share code, notes, and snippets.

View Amareis's full-sized avatar

Иван Плесских Amareis

View GitHub Profile
@Amareis
Amareis / bridge.ts
Last active April 26, 2022 12:13
Простой интероп между плагином фигмы и его UI. Основан на прокси, полностью типизирован, результат метода автоматически заворачивается в Promise
type Handlers = Record<string, (...args: any) => void>
const isPlugin = typeof figma !== 'undefined'
const res: Record<number, (t: any) => void> = {}
export function handlers<T extends Handlers>(methods: T): T {
const t = isPlugin ? figma.ui : window
t.onmessage = async (m: any) => {
const { method, args } = m.data ? m.data.pluginMessage.pluginMessage : m
@Amareis
Amareis / connect.sh
Created March 23, 2021 10:32
Simple bash script to switch connected Android phone to wi-fi adb mode and optionally forward port from computer to phone
#!/bin/bash
if ! command -v adb &> /dev/null
then
echo "adb is not globally installed, using android sdk version"
#you can just set your path to android platform tools
export PATH="$PATH:~/Android/Sdk/platform-tools"
fi
adb disconnect
@Amareis
Amareis / MaskedInput.jsx
Last active December 6, 2017 11:58 — forked from prontiol/MaskedInput.tsx
react-text-mask focus workaround
import React from 'react'
import TextMask from 'react-text-mask'
export default class CustomTextMask extends TextMask {
render() {
const {value, ...props} = this.props
return (
<input
{...props}
onFocus={this.onFocus}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Amareis
Amareis / Курсы
Last active August 9, 2017 10:17
Курсы
Перед началом
=============
Скачай и установи Python 3 с официальной страницы.
Если ты пользуешься Windows, качай инсталлер [отсюда (32 bit)](https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe) или же [отсюда (64 bit)](https://www.python.org/ftp/python/3.5.1/python-3.5.1-amd64.exe).
Если же у тебя linux-based дистрибутив, весьма вероятно что питон у тебя уже имеется - напиши `python3` в консоли и, если запустился интерпретатор, можно двигаться дальше. Если нет - делай `sudo apt-get install python3` (в случае debian-based дистра).
Убедись что запускается простейшая программа. Создай файл hello.py, напиши в него `print("Hello world!")` и далее в консоли из каталога с этим файлом `python hello.py` для винды (также можно просто запустить этот файл прямо из проводника) или, для линуксов `python3 hello.py`
Желательно полистать пару туториалов чтобы понять базовый синтаксис, но это не строго обязательно.