Skip to content

Instantly share code, notes, and snippets.

View asonnleitner's full-sized avatar
:shipit:

Andreas Sonnleitner asonnleitner

:shipit:
  • {}
View GitHub Profile
const locales = ['cs', 'hu', 'pl', 'ro', 'sk', 'en']
const countries = ['CZ', 'HU', 'PL', 'RO', 'SK', 'US']
export async function fetchTerritories(locale: string) {
const response = await fetch(`https://raw.githubusercontent.com/unicode-org/cldr-json/main/cldr-json/cldr-localenames-full/main/${locale}/territories.json`)
const json = await response.json() as Record<string, Record<string, Record<string, Record<string, Record<string, string>>>>>
return json.main[locale].localeDisplayNames.territories
}
// get translations from all locales for all territories
MAX_LENGTH = 4
zlomky = Array.new
puts "Zadejte zlomky:"
10.times do |i|
zlomek = Hash.new
zlomek["citatel"] = gets.chomp.to_i
zlomek["jmenovatel"] = gets.chomp.to_i
# static constants
FRACTIONS_COUNT = 2
MIN_NUM = 1
MAX_NUM = 9999
# dynamic constants
CHAR_COUNT = MAX_NUM.to_s.length
FRACTION_DIVIDER = '-' * CHAR_COUNT
# helper function for getting user input

Keybase proof

I hereby claim:

  • I am asonnleitner on github.
  • I am asonnleitner (https://keybase.io/asonnleitner) on keybase.
  • I have a public key ASBSEbtLNvh_5MfnFXchE1CJysTotaRIVBrG0tq8VeYN4Qo

To claim this, I am signing this object:

puts "Zadejte a, b, c"
a = gets.chomp.to_f # konverze na float
b = gets.chomp.to_f
c = gets.chomp.to_f
# Výpočet diskriminantu
DIS = b**2 - 4 * a * c
puts "Diskriminant je #{DIS}"
if DIS > 0
#!/usr/bin/env bash
# Install docker with docker-compose optionally on Amazon Linux 2
# Copyright 2021 asonnleitner
# -e : exit immediately if a command exits with a non-zero status
# -u : treat unset variables as an error when substituting
# -o pipefail : pipe commands to fd 3 in case a command in a pipe fails
set -euo pipefail

Regular Expression for Go version

/^((go)([1-9]\d*))(\.(0|[1-9]\d*))?(\.(0|[1-9]\d*))?$/gm

Demo

https://regexr.com/67ijh