Skip to content

Instantly share code, notes, and snippets.

View RobertoUa's full-sized avatar
🎯
Focusing

Volodymyr Barna RobertoUa

🎯
Focusing
  • Ukraine, Ternopil
View GitHub Profile
@RobertoUa
RobertoUa / sector.js
Created March 4, 2024 06:39
thecrag show sector
document.querySelectorAll('.rt_name > span > a').forEach(e => {
const t = e.title.split('›').slice(-2).pop().trim();
const span = document.createElement('span');
div.innerHTML = ` at ${t}`;
e.parentElement.appendChild(span);
});
@RobertoUa
RobertoUa / tee.patch
Last active August 10, 2022 09:26
for ffmpeg 5.1
diff --git a/libavformat/tee.c b/libavformat/tee.c
index 6fafc0a99d..e31e00496c 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -20,6 +20,7 @@
*/
+#define _GNU_SOURCE
#include "libavutil/avutil.h"
@RobertoUa
RobertoUa / groupWeighedWithin.scala
Created March 14, 2022 10:22
fs2 groupWeighedWithin
implicit class StreamOps[F[_], O](private val s: Stream[F, O]) extends AnyVal {
def groupWeighedWithin(timeout: FiniteDuration, limit: Long, weight: O => Long)(implicit
F: Temporal[F]
): Stream[F, Chunk[O]] =
s.pull
.timed { timedPull =>
def go(timedPull: Pull.Timed[F, O], buffer: Chunk[O], bufferSize: Long): Pull[F, O, Unit] = {
timedPull.timeout(timeout) >>
timedPull.uncons.flatMap {
@RobertoUa
RobertoUa / TestContextShiftTest.scala
Created April 30, 2020 02:20 — forked from Daenyth/IOAssertions.scala
TestContext + scalatest usage
import cats.effect.laws.util.TestContext
import cats.effect.{ContextShift, IO, Timer}
import org.scalactic.source.Position
import org.scalatest.{Assertion, AsyncFunSpec, AsyncTestSuite, Matchers}
import org.scalatest.exceptions.TestFailedException
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future}
import scala.reflect.ClassTag
@RobertoUa
RobertoUa / README.md
Created December 26, 2018 17:33 — forked from pathikrit/README.md
My highly opinionated list of things needed to build an app in Scala
@RobertoUa
RobertoUa / FixIdeaAkkaHttp.scala
Created October 28, 2017 10:29
Fix error highlighting in akka-http test
//fixes IntelliJ error highlighting
implicit class FixIdea(request: HttpRequest) {
def ~>(r: Route): RouteTestResult = TildeArrow.injectIntoRoute.apply(request, r)
def ~>(f: HttpRequest ⇒ HttpRequest) = f(request)
}
def uploadedFile(fieldName: String): Directive1[(FileInfo, File)] =
extractRequestContext.flatMap { ctx
import ctx.executionContext
import ctx.materializer
fileUpload(fieldName).flatMap {
case (fileInfo, bytes)
val destination = File.createTempFile("akka-http-upload", ".tmp")
val uploadedF: Future[IOResult] = bytes.runWith(FileIO.toPath(destination.toPath))
{
"meta": {
"id": "efd7ca55b4c654ec227f2117",
"created": 1439356911278,
"modified": 1439357417823,
"author": "t5Sq+f6v5KBknFKgOTdmHrZQKQgyTeNF0H0udYw7IiJtyRejIVxbtQ==",
"authorUsername": "Nataliia.Parilova",
"description": "",
"name": "edit-11819_linear gradient",
"duration": 1.0,

Keybase proof

I hereby claim:

  • I am robertoua on github.
  • I am robertoua (https://keybase.io/robertoua) on keybase.
  • I have a public key whose fingerprint is C446 39E3 E8EC 75B9 CC1A D014 6755 BE70 87B9 58EC

To claim this, I am signing this object:

{
"Andorra":"AD",
"United Arab Emirates":"AE",
"Afghanistan":"AF",
"Antigua and Barbuda":"AG",
"Anguilla":"AI",
"Albania":"AL",
"Armenia":"AM",
"Angola":"AO",
"Antarctica":"AQ",