Skip to content

Instantly share code, notes, and snippets.

View ilamanov's full-sized avatar

Nazar Ilamanov ilamanov

View GitHub Profile
@ilamanov
ilamanov / PieChartView.swift
Created April 25, 2021 22:44
Creating SwiftPieChart: rows def
struct PieChartRows: View {
var colors: [Color]
var names: [String]
var values: [String]
var percents: [String]
var body: some View {
VStack{
ForEach(0..<self.values.count){ i in
HStack {
@ilamanov
ilamanov / PieChartView.swift
Created April 25, 2021 22:48
Creating SwiftPieChart: render rows
var body: some View {
GeometryReader { geometry in
VStack{
ZStack{
ForEach(0..<self.values.count){ i in
PieSliceView(pieSliceData: self.slices[i])
}
.frame(width: geometry.size.width, height: geometry.size.width)
Circle()
@ilamanov
ilamanov / PieChartView.swift
Created April 25, 2021 22:50
Creating SwiftPieChart: complete
import SwiftUI
struct PieChartView: View {
public let values: [Double]
public var colors: [Color]
public let names: [String]
public var backgroundColor: Color
public var innerRadiusFraction: CGFloat
@ilamanov
ilamanov / README.md
Last active December 11, 2021 07:17
MetaMask React Auth Component

MetaMask React Auth Component

MetaMask Fox logo

Works on desktop and mobile!

MetaMask Fox logo



@ilamanov
ilamanov / if
Created January 24, 2022 10:47
If condition
if (condition) {
what we should do in that case
}
@ilamanov
ilamanov / categorize.js
Last active January 24, 2022 11:06
categorizer
function CATEGORIZE(transaction) {
const [card, date, description, amount] = transaction[0]
if (description.toLowerCase().includes("starbucks") ||
description.toLowerCase().includes("taqueria")) {
return "takeout"
} else if (description.toLowerCase().includes("carwash") ||
description.toLowerCase().includes("chevron") ||
description.toLowerCase().includes("exxon")) {
return "car"
@ilamanov
ilamanov / newMessage.js
Last active January 29, 2022 08:20
Telegram BOT contant reply
const TELEGRAM_TOKEN = "..."
export default async (req, res) => {
const chat_id = req.body.message.chat.id;
await respond(chat_id, "Buy Milk")
res.status(200).send({});
}
@ilamanov
ilamanov / newMessage.js
Last active January 29, 2022 08:25
Read Telegram message and extract info
const TELEGRAM_TOKEN = "..."
export default async (req, res) => {
const chat_id = req.body.message.chat.id;
try {
const sentMessage = req.body.message.text;
const splitInHalf = sentMessage.split("Remind in")
const firstPart = splitInHalf[0].trim()
} catch (e) {
await respond(chat_id, `Your message needs to be in this format "Do X. Remind in Y minutes"`)
}
@ilamanov
ilamanov / IERC721.sol
Created March 1, 2022 14:33
Functions that should be implemented according to ERC721
pragma solidity ^0.4.20;
interface ERC721 {
function name() external view returns (string _name);
function symbol() external view returns (string _symbol);
function tokenURI(uint256 _tokenId) external view returns (string);
function totalSupply() external view returns (uint256);
function tokenByIndex(uint256 _index) external view returns (uint256);
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);