Skip to content

Instantly share code, notes, and snippets.

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
var scaner = new Scanner(System.in);
System.out.println("What is the weight (kg)?");
var weight = scaner.nextDouble();
System.out.println("UAH per kg?");
else if (text.equals("doge")) {
var price = CryptoPrice.spotPrice("DOGE");
message.setText("Dogecoin price: " + price.getAmount().doubleValue());
}
else if (text.equals("/all")) {
var priceBTC = CryptoPrice.spotPrice("BTC");
var priceETH = CryptoPrice.spotPrice("ETH");
var priceDOGE = CryptoPrice.spotPrice("DOGE");
message.setText("BTC price: " + priceBTC.getAmount().doubleValue() + " ETH price: " + priceETH.getAmount().doubleValue() + " DOGE price: " + priceDOGE.getAmount().doubleValue());
}
else if (text.matches("^\\d+$")) {
int number = Integer.parseInt(text);
var priceBTC = CryptoPrice.spotPrice("BTC");
var priceETH = CryptoPrice.spotPrice("ETH");
var priceDOGE = CryptoPrice.spotPrice("DOGE");
double btcPrice = priceBTC.getAmount().doubleValue();
double ethPrice = priceETH.getAmount().doubleValue();
double dogePrice = priceDOGE.getAmount().doubleValue();
message.setText("BTC quantity: " + number / btcPrice + " ETH quantity: " + number / ethPrice + " DOGE quantity" + number / dogePrice);
}
void sendPic(long chatId, String namePic) throws Exception {
var pic = getClass().getClassLoader().getResource(namePic);
var message = new SendPhoto();
message.setChatId(chatId);
message.setPhoto(new InputFile(pic.openStream(), namePic));
execute(message);
}
void sendAllPics(long chatId) throws Exception {
sendPic(chatId, "b.png");
sendPic(chatId, "e.png");
@dmkomur
dmkomur / 4.2
Last active July 27, 2024 13:35
package org.example;
import net.thauvin.erik.crypto.CryptoPrice;
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
import org.telegram.telegrambots.meta.api.methods.send.SendPhoto;
import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
@dmkomur
dmkomur / hello-world.html
Created October 31, 2025 08:03
Simple Hello World snippet
<h1>Hello, world</h1>
import { Directive, ElementRef, Input, OnChanges, Renderer2, SimpleChanges } from '@angular/core';
import { from, of } from 'rxjs';
import { concatMap, delay } from 'rxjs/operators';
@Directive({
selector: '[appTypingAnimation]',
standalone: true,
})
export class TypingAnimationDirective implements OnChanges {
@Input() appTypingAnimation: string = '';