Skip to content

Instantly share code, notes, and snippets.

View fokot's full-sized avatar

František Kocun fokot

  • Bratislava, Slovakia
View GitHub Profile
@fokot
fokot / Typeclasses.scala
Last active December 26, 2015 17:49
Expression and Json are typeclasses
package typeclasses
import json._
trait Expression[A] {
def value(expression: A): Int
}
case class Number(value: Int)
.tooltip {
background: #eee;
box-shadow: 0 0 5px #999999;
color: #333;
display: none;
font-size: 12px;
left: 130px;
padding: 10px;
position: absolute;
text-align: center;
@fokot
fokot / barchart.html
Created May 2, 2016 14:46
D3 barchart
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.bar {
fill: steelblue;
}
.x.axis path {
fill: none;
@fokot
fokot / Example.scala
Created November 4, 2016 12:09
Akka-http + specs2 routes testing
package com.raptorintelligence
import akka.http.specs2.RouteTestSpecs2
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification
class ConnectotMicroserviceTest extends Specification with RouteTestSpecs2 {
"routes are tested" >> { implicit ee: ExecutionEnv =>
Get("/test") ~> ConnectorMicroservice.route ~> checkEntity must equalTo("this is test").await
@fokot
fokot / JIRA2Git.user.js
Last active January 20, 2017 08:34
JIRA 2 git commit name - tampermonkey plugin
// ==UserScript==
// @name JIRA2Git
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://ceai-io.atlassian.net/browse/*
// @grant none
// ==/UserScript==
(function() {
@fokot
fokot / SchemaCompare.scala
Last active June 29, 2017 11:51
GraphQL schema compare
package raptorclientapi
import io.circe.Encoder
import io.circe.parser.parse
import sangria.schema.{Schema, SchemaChange}
import scalaj.http.{Http => SJHttp}
import sangria.marshalling.circe.CirceInputUnmarshaller
import io.circe._
import io.circe.generic.semiauto._
@fokot
fokot / ShapelessTest.scala
Created August 23, 2017 15:23
Shapeless - two classes to list
import shapeless._
import shapeless.labelled.{FieldType, field}
import shapeless.ops.hlist.{Align, ToTraversable, ZipWith}
object ShapelessTest {
def zipClasses[A, B, P <: Poly2, ARepr <: HList, BRepr <: HList, R <: HList, X]
(a: A, b: B, f: P)(
implicit
@fokot
fokot / gist:edbeec7de61552a291ef566bb55fba7e
Created October 4, 2017 11:13
Bi-directional ssh tunnel
#!/bin/bash
export EXTERNAL_PORT=$(cat conf/application.conf | awk -F'=' '/web.port/ {printf $2}' | tr -d ' ')
# this is the port for externalAddress
export TEMP_PORT=3331
echo ""
echo "Connecting localhost:$EXTERNAL_PORT to <SERVER>:8076"
echo "As externalAddress in application.conf use \"http://localhost:$TEMP_PORT\""
echo ""
@fokot
fokot / MiniTest.scala
Last active December 13, 2019 15:25
ZIO workshop
package com.upstartcommerce.rating
import zio.ZIO
import zio.console.Console
object MiniTest extends zio.App {
trait GetUser {
def user: User
@fokot
fokot / docker-compose.yml
Last active November 1, 2020 21:06
Wordpress with mysql
version: '3.3'
services:
db:
image: mysql:latest
volumes:
- db_data:/var/lib/mysql
ports:
- 3306:3306
restart: always