Skip to content

Instantly share code, notes, and snippets.

@railroadman
railroadman / Dockerfile
Created October 5, 2024 08:00
docker-react-nginx
# Dockerfile
FROM node:18-alpine as build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . . # Убедитесь, что копируется весь проект, включая index.html и все исходные файлы
RUN npm run build
@railroadman
railroadman / sardines.css
Created September 29, 2024 09:46
sardines.html
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
background-color: #3848a0;
font-family: 'Open Sans', arial, sans-serif, system-ui;
margin: 0 auto;
}
import folium
from IPython.display import display
map_center = [52.520,13.4050]
mymap = folium.Map(location=map_center,zoom_start=15)
folium.Marker (
[52.520,13.4050],
popup="Berlin",
icon=folium.Icon(color="blue", icon="info-sign")
@NamedNativeQuery(
name = "getTenders",
query = "SELECT t.id, t.created_at, CONCAT(u.first_name, ' ' , u.last_name) as created_by, t.modified_at, CONCAT(u2.first_name, ' ' , u2.last_name) as modified_by, t.tenders_abbreviation, t.tenders_full_name FROM abc.tenders v\n" +
"LEFT JOIN abc.users u on u.id = v.created_by LEFT JOIN rbac.users u2 on u2.id = v.modified_by",
resultSetMapping = "tendersMappings"
)
@SqlResultSetMapping(name = "tendersMappings", entities = {
@EntityResult(entityClass = TendersEntity.class, fields = {
@FieldResult(name = "id", column = "id"),
AccountDetails accountDetails = new AccountDetails();
CompletableFuture.allOf(
CompletableFuture.
supplyAsync(() -> //CALL MORTAGE INFO REST, executor).
thenAccept(x -> {
accountDetails.setMortgageAccountId(x.getReqdField())
}).
handle(//HANDLE GRACEFULLY),
CompletableFuture.
private <T> PagingResponseDto<T> makePagingResponse( T clazz, PagingRequestDto pagerParams) {
var response = new PagingResponseDto<T>(maxPagingRows);
Integer size = pagerParams.getSize();
Integer page = pagerParams.getPage();
response.setSize(size == null || size <= 0 ? maxPagingRows : size);
response.setPage(page);
return response;
}
this.makePagingResponse(new IdNameResponseDto(),param);
GET /products/_search
{
"query":
{
"wildcard":
{"details.product":"поду*"}
}
}
PUT /products2
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "my_ngram_tokenizer",
from random import sample
numbers = range(1,200)
for _ in range(10):
print(sample(numbers,5))
@railroadman
railroadman / class_definitions.java
Created July 11, 2020 13:31
Работа с java reflect
package com.mypackage.bean;
public class Dog {
private String name;
private int age;
public Dog() {
// empty constructor
}