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 Loggers { | |
final val Welcome = "welcome" | |
final val Messages = "messages" | |
final val Users = "messages" | |
type MessagesLogging[F[_]] = Logging[F] @Id(Welcome) | |
type UsersLogging[F[_]] = Logging[F] @Id(Users) | |
type WelcomeLogging[F[_]] = Logging[F] @Id(Messages) |
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
private def buildTelegramClient[F[_]: Execute: ConcurrentEffect](isProd: Boolean, token: String): Resource[F, TelegramClient[F]] = | |
buildHttp4sClient.map { httpsClient => | |
TelegramClient.fromHttp4sClient[F](token)( | |
if (isProd) httpsClient | |
else ResponseLogger(true, true)(httpsClient) | |
) | |
} |
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 org.daron.html | |
import cats.syntax.either._ | |
import cats.syntax.flatMap._ | |
import cats.syntax.functor._ | |
import com.softwaremill.sttp.{SttpBackend, _} | |
import io.chrisdavenport.log4cats.Logger | |
trait HttpClient[F[_]] { | |
def getPageSource(uri: java.net.URI): F[String] |
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
def getBlocks: Route = (get & paging & sorting(sortByFieldMappings, Some("height")) & startEndDate) { | |
(o, l, field, so, start, end) => | |
val sTs = start.getOrElse(0L) | |
val eTs = end.getOrElse(System.currentTimeMillis() + oneDayMillis) | |
val p = Paging(offset = o, limit = l) | |
val s = Sorting(sortBy = field, order = so) | |
val items = bs.getBlocks(p, s, sTs, eTs) | |
val count = bs.count(sTs, eTs) | |
val itemsResponse = (items, count).parMapN(ItemsResponse.apply) | |
itemsResponse |
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
case class Data(v: String, k: String) | |
case class DataMap(map: Map[String, Data]) | |
val cfg = """ | |
|example { | |
| map { | |
| "1" : { | |
| v: "v" | |
| k: "k" | |
| } |
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
const puppeteer = require('puppeteer'); | |
let scrape = async () => { | |
const browser = await puppeteer.launch({headless: false}); | |
const page = await browser.newPage(); | |
await page.goto('https://yandex.ru/maps/213/moscow/?ll=37.820579%2C55.730541&z=12&mode=routes&rtext=55.707218%2C37.962004~55.753747%2C37.681371&rtt=auto'); | |
await page.waitFor(3000); | |
const raw = await page.evaluate(() => { |
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
name := "scapegoat-not-working" | |
version := "0.1" | |
scalaVersion := "2.12.4" | |
scapegoatVersion in ThisBuild := "1.3.3" |
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
val l1 = List(1,2,3,4,4,5) | |
val l2 = List(1,4,2,3,4,5) | |
val l3 = List(1,2,2,3,4,5) | |
def check[T](l1: List[T], l2: List[T]): Boolean = { | |
l1.groupBy(identity) == l2.groupBy(identity) | |
} | |
check(l1, l2) | |
check(l1, l3) |
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
var casper = require('casper').create({logLevel: "error"}); | |
var url = 'https://yandex.ru/maps/213/moscow/?rtext=55.707218%2C37.962004~55.753747%2C37.681371&rtt=auto&l=trf%2Ctrfe&mode=routes&ll=37.818532%2C55.741678&z=11'; | |
casper.options.viewportSize = { width: 1920, height: 1080 }; | |
casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36'); | |
casper.start(url, function() { | |
casper.waitForSelector('.driving-route-view__route-title-primary', function() { | |
this.echo(this.evaluate(getSelectedItems)); | |
}); | |
}); |
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 ForEachExperiment extends App { | |
trait ForEach[M[_]] { | |
def foreach[V](m: M[V])(f: V => Unit ): Unit | |
} | |
object ForEachInstances { |
NewerOlder