- MaterialDesignThemes
- HandyControl
- Microsoft.MLNet
- Emgu.CV
| import java.util.Map; | |
| import java.util.stream.Collector; | |
| import java.util.stream.Collectors; | |
| public final class AppCollectors { | |
| private AppCollectors() { } | |
| public static <K, V> Collector<? super Map.Entry<K, V>, ?, Map<K, V>> toMapFromEntries() { | |
| return Collectors.toMap(Map.Entry<K, V>::getKey, Map.Entry<K, V>::getValue); | |
| } |
const fieldsStrings = $value.split(',\n');
fieldsStrings.map(fieldString => {
const regex = /\s*(\S+)\s+(\S+)\s*(.*)\s*/ms;
const [, columnName, columnType, columnParams] = regex.exec(fieldString);
return `${columnName},${columnType}${columnParams ? ',' + columnParams.replace(/\s\s+/g, ' ') : ''}`;
}).join('\n');$value
| const and = (a, b) => a ? b : a; | |
| const or = (a, b) => a ? a : b; |
| // based on: https://ru.stackoverflow.com/a/962892/393687 | |
| function switchKeyboardLayout(str) { | |
| const lettersMap = { | |
| "q":"й", "w":"ц", "e":"у", "r":"к", "t":"е", "y":"н", "u":"г", | |
| "i":"ш", "o":"щ", "p":"з", "[":"х", "]":"ъ", "a":"ф", "s":"ы", | |
| "d":"в", "f":"а", "g":"п", "h":"р", "j":"о", "k":"л", "l":"д", | |
| ";":"ж", "'":"э", "z":"я", "x":"ч", "c":"с", "v":"м", "b":"и", | |
| "n":"т", "m":"ь", ",":"б", ".":"ю", "/":"." | |
| }; |
| const EN_LAYOUT = '`1234567890-=qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?'; | |
| const RU_LAYOUT = 'ё1234567890-=йцукенгшщзхъ\\фывапролджэячсмитьбю.Ё!"№;%:?*()_+ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,'; | |
| const mapLayouts = (sourceLayout: string, targetLayout: string): Record<string, string> => { | |
| if (sourceLayout.length !== targetLayout.length) { | |
| throw new Error('Different length of layouts'); | |
| } | |
| const result: Record<string, string> = {}; |
| package com.mrgrd56.javamapbuilder; | |
| import org.springframework.lang.NonNull; | |
| import org.springframework.lang.Nullable; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.function.Supplier; | |
| /** |
| class Switch<T, V = never> { | |
| constructor(private readonly object: T) {} | |
| static of<T>(object: T) { | |
| return new Switch(object); | |
| } | |
| private readonly conditions = new Map<T, () => unknown>(); | |
| private defaultValue: { current: () => unknown } | undefined = undefined; |