Skip to content

Instantly share code, notes, and snippets.

@EugenyB
EugenyB / general.html
Created April 27, 2025 21:31
fragment
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head th:fragment="headerfiles">
<meta charset="UTF-8" />
<link th:href="@{/css/styles.css}" rel="stylesheet">
</head>
<body>
<div th:fragment="header" class="navbar">
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<div class="container-fluid">
@EugenyB
EugenyB / confirm.js
Last active April 27, 2025 20:13
confirm.js
let myConfirmDialog = document.getElementById("myconfirm");
myConfirmDialog.addEventListener('show.bs.modal', function (event) {
let button = event.relatedTarget;
let link = button.getAttribute('data-bs-link');
let id = button.getAttribute('data-bs-id');
let text = button.getAttribute('data-bs-text');
let modalTitle = document.getElementById('staticWarningLabel');
modalTitle.textContent = 'Delete: ' + text + ' (' + id + ')';
let modalText = myConfirmDialog.querySelector('.modal-text');
@EugenyB
EugenyB / mvn.xml
Created April 27, 2025 15:52
Bootstrap with maven
<!-- https://mvnrepository.com/artifact/org.webjars.npm/bootstrap -->
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap</artifactId>
<version>5.3.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars.npm/bootstrap-icons -->
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap-icons</artifactId>
@EugenyB
EugenyB / payara-resources.xml
Created March 14, 2025 10:54
Small payara-resources.xml or glassfish-resources.xml - put in WEB-INF folder
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 6.2023 Resource Definitions//EN" " ">
<!--
fill the data according to comments
-->
<resources>
<!-- pool name (change nuospool), for example java:app/db_pool-->
<jdbc-connection-pool name="nuospool"
datasource-classname="com.mysql.cj.jdbc.MysqlDataSource"
res-type="javax.sql.DataSource">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 6.2023 Resource Definitions//EN" " ">
<!--
Заповнити дані - див.коментарі
-->
<resources>
<!-- ім'я пула (замінити poolname), наприклад java:app/db_pool-->
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false"
connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 6.2023 Resource Definitions//EN" " ">
<!--
Заповнити дані - див.коментарі
-->
<resources>
<!-- ім'я пула (замінити poolname), наприклад java:app/db_pool-->
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false"
connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10"
connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0"
fun main() {
//val arr = intArrayOf(1, 2, -5, 7, 9, 0, 15, -4, 9)
//val fiveOfFives = IntArray(5) { 5 }
val n = readln().toInt()
val arr = readArrayFromLine()
val res = minimumsToTheLeft(arr)
printArray(res)
// val max = maxOfArray(arr)
@EugenyB
EugenyB / context.xml
Created August 12, 2022 16:24
context.xml example
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
// Exercise 11: Gather the words into a map, accumulating a count of the
// number of occurrences of each word. Don't worry about upper case and
// lower case. Extra challenge: implement two solutions, one that uses
// groupingBy() and the other that uses toMap().
@Test
public void wordFrequencies() throws IOException {
// Map<String, Long> map = reader.lines()
// .flatMap(s -> Arrays.stream(s.split(REGEXP)))
// .filter(s -> !s.isEmpty())
@EugenyB
EugenyB / settings.xml
Created February 16, 2021 09:33
maven settings for nuos proxy
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>10.10.0.105</host>
<port>3128</port>