Skip to content

Instantly share code, notes, and snippets.

import java.sql.{Connection, DriverManager}
import scala.io.StdIn._
object FreeMonads {
def getUserPwd(id: String)(c: Connection): String = {
""
}
@tyrcho
tyrcho / Units.scala
Created July 18, 2017 07:26
Scala Units of Measures, using implicits & generics
// inspired from http://bentrengrove.com/blog/2017/5/21/fun-with-types-extensions-and-generics-in-kotlin
// and http://javanut.net/2017/05/23/more-fun-with-generics-in-kotlin/
// a complete library : http://www.squants.com/
import Distance._
import Time._
trait UnitOfMeasure {
def name: String
@tyrcho
tyrcho / README.md
Last active December 1, 2022 15:48
JIRA JQL tricks

Search for issues

project = Deepsky and "Business Value">0 AND cf[10953]>0 and 
issueFunction in aggregateExpression("bv","BusinessValue.average()","sp","StoryPoints.average()")

Quick filter

 issueFunction in expression("", "BusinessValue / (StoryPoints+0.01) > 5")

To show non resolved task which are likely to slip

<input type="submit" onClick="plusOne()" value="+1"/>
<input type="submit" onClick="minusOne()" value="-1"/>
<input type="submit" onClick="reset()" value="reset"/>
<table width="200" border="0" align="center">
<tbody style="display:flex"><tr>
<td><img src="on.png" name="C1" width="50" height="50" id="C1" alt=""></td>
<td><img src="on.png" name="C2" width="50" height="50" id="C2" alt=""></td>
<td><img src="on.png" name="C3" width="50" height="50" id="C3" alt=""></td>
<td><img src="off.png" name="C4" width="50" height="50" id="C4" alt=""></td>
</tr>
import math._
object QuadraticInterception extends App {
val me = Pos(100, 100)
val tgt = Pos(400, 400)
val tgtDirection = Pos(0, -100)
println(me.intercept(tgt, tgtDirection))
case class Pos(x: Int, y: Int) {
@tyrcho
tyrcho / Main.scala
Last active January 26, 2021 11:01 — forked from anonymous/Main.scala
Scala.js Asynchronous REST call (Ajax) demo with JSON parsing - http://www.scala-js-fiddle.com/gist/484e6ca68976aadb2cac63b55069acd8
import util._
import dom.ext._
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow
object ScalaJSExample extends js.JSApp{
def main(): Unit = {
val url =
"http://jsonplaceholder.typicode.com/posts/1"
val f=Ajax.get(url)
f.onComplete{
import org.scalajs.dom
import dom.html
object ScalaJSExample extends js.JSApp {
val document = js.Dynamic.global.document
var question:Option[Question] = None
def main() = {
//fullScreenMode()
println(div(
@tyrcho
tyrcho / Main.scala
Last active December 30, 2017 12:45 — forked from anonymous/Main.scala
SPA (Single Page Application) demo with scala-js and scalatags. Live http://www.scala-js-fiddle.com/gist/0fbfc1a74a4f91e033e531a68012e145
// See http://www.lihaoyi.com/hands-on-scala-js/#Scalatags
import org.scalajs.dom
import dom.html
import scalajs.js.annotation.JSExport
object ScalaJSExample extends js.JSApp {
val document = js.Dynamic.global.document
def main() = {
@tyrcho
tyrcho / FullPageScalaJSExample.scala
Last active June 15, 2016 07:51
Sample to use scala-js-fiddle in full page mode (to hide the source from the users) - http://www.scala-js-fiddle.com/gist/b70c40da900a7dd984496de7ca0eb297
object ScalaJSExample extends js.JSApp{
def main() = {
val document = js.Dynamic.global.document
document.getElementById("logspam").style="display:none"
document.getElementById("sandbox").style="bottom:0; left:0"
document.getElementById("editor").style="display:none"
println("hello")
}
}
@tyrcho
tyrcho / README.md
Last active November 27, 2021 05:07
Find and recompress from x265 to x264 with ffmpeg