Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="notepadplusplus" />
<package id="vim" />
<package id="7zip" />
<package id="python" />
<package id="pip" />
<package id="putty" />
<package id="Console2">
package com.timetrade.wciservice.controller;
import com.timetrade.wciservice.config.ConfigurationResolver;
import com.timetrade.wciservice.config.properties.LicenseeAdminConfigData;
import com.timetrade.wciservice.domain.VerifyConfigurationResponse;
import com.timetrade.wciservice.domain.VideoProviderEntity;
import com.timetrade.wciservice.exceptions.WCIException;
import com.timetrade.wciservice.provider.ProvidersResolver;
import com.timetrade.wciservice.provider.WebConferenceProvider;
public WebConferenceProvider resolve(String providerId) {
VideoProviderEntity providerEntity = VideoProviderEntity.findById(providerId).orElseThrow(() ->
new ServiceInternalException("Cannot resolve provider with id: " + providerId)
);
return applicationContext.getBean(providerEntity.getProviderClass());
}
@feoktant
feoktant / LoggingUtils.scala
Created May 19, 2020 08:45
Logging request as cUrl
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.server.Directive0
import akka.http.scaladsl.server.directives.{DebuggingDirectives, LoggingMagnet}
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.stream.Materializer
import org.slf4j.Logger
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success}
@feoktant
feoktant / top_n_from_categories.sql
Created July 6, 2020 00:33
Small example how to select N last rows from categories
create table category
(
category_id serial primary key,
title varchar not null
);
create table post
(
post_id serial primary key,
category_id int not null references category,
@feoktant
feoktant / mongoDotNotation.scala
Created March 3, 2021 12:38
Trying to achieve the same bson path as in KMongo
package io.feoktant.path
package domain
import scala.annotation.tailrec
object App extends App {
println(Sample.UserFields.emailAddress.id)
println(Sample.UserFields.emails(3).value)
}
@feoktant
feoktant / Day4.scala
Created December 4, 2022 22:13
Day4
val InputRegex = "(\\d+)-(\\d+),(\\d+)-(\\d+)".r
def matchFullContain(str: String): Boolean = str match {
case InputRegex(t1, t2, e1, e2) =>
(t1.toInt <= e1.toInt && e2.toInt <= t2.toInt) ||
(e1.toInt <= t1.toInt && t2.toInt <= e2.toInt)
case _ => false
}
def matchOverlap(str: String): Boolean = str match {