This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Returns a resource that contains a ref set to the last element of the stream. | |
| */ | |
| def streamRef[F[_] : Async, A](stream: Stream[F, A], default: A): Resource[F, RefSource[F, A]] = { | |
| val ri = for | |
| ref <- Ref.of(default) | |
| interrupt <- SignallingRef.of(false) | |
| _ <- Async[F].start { | |
| stream |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class KlinesRepositorySpec extends UnitSpec with TimescaleSuite(Some("/database.sql")) { | |
| "KlinesRepository" should "return last klines" in { | |
| withTimescale { timescale => | |
| val repository = new KlinesRepository(timescale.xa) | |
| val date = LocalDate.of(2021, 1, 1) | |
| .atStartOfDay() | |
| .atOffset(ZoneOffset.UTC) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cats.effect.* | |
| import cats.effect.unsafe.IORuntime | |
| import org.postgresql.core.ConnectionFactory | |
| // repository, two services, and api: | |
| class Repository(conn: ConnectionFactory) {} | |
| class ServiceA(repo: Repository) {} | |
| class ServiceB(repo: Repository) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| directories: | |
| domains | |
| targets: | |
| //domains/... | |
| # //...:all | |
| additional_languages: | |
| # Uncomment any additional languages you want supported | |
| # android |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.x2sy.logserver | |
| import java.io.File | |
| import com.typesafe.config.Config | |
| import com.typesafe.config.ConfigException.BadValue | |
| import net.ceedubs.ficus.readers.ValueReader | |
| trait FicusFileReader { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| consul: | |
| image: progrium/consul:latest | |
| # net: host | |
| ports: | |
| - "8400:8400" | |
| - "8500:8500" | |
| command: "-server -bootstrap -ui-dir /ui" | |
| registrator: | |
| command: -resync 30 -internal consul://consul:8500 | |
| image: gliderlabs/registrator:latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Gratuitously stolen from @mathiasbynens | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # Disable menu bar transparency | |
| defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false | |
| # Expand save panel by default | |
| defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
| # Expand print panel by default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Database extends Logging { | |
| private var _instance: GraphDatabaseService = null | |
| def instance: GraphDatabaseService = { | |
| if (null == _instance) { | |
| synchronized { | |
| if (null == _instance) { | |
| _instance = initDatabase() | |
| } |