val myClass = CssClassDecl("myClass")
val myCss1: CssDecl = css"""
/* Any valid CSS */
.$myClass {
...
}
This file contains 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
version: "3.0" | |
services: | |
minecraft: | |
image: itzg/minecraft-server | |
ports: | |
- "25565:25565" | |
volumes: | |
- "./data:/data" | |
environment: |
This file contains 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
sealed trait MyList[+T] | |
case object MyNil extends MyList[Nothing] | |
case class MyCons[+T](value: T, tail: MyList[T]) extends MyList[T] | |
object MyList { | |
def empty[T]: MyList[T] = MyNil | |
implicit class MyListOps[A](val self: MyList[A]) extends AnyVal { | |
This file contains 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
#!/usr/local/bin/amm | |
import ammonite.ops._ | |
import ammonite.ops.ImplicitWd._ | |
val issue = "#(\\d+)".r | |
@main def main( | |
tag: String = %%("git", "describe", "--abbrev=0", "--tags").out.trim) = { |
This file contains 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
trait MyService[F[_], S[_]] { | |
def getItem(id: Long): F[Item] | |
def getItemsByGroup(groupId): F[S[Item]] | |
} | |
class MyServiceImpl[F[_], S[_]](xa: Transactor[F]) extends MyService { | |
def getItemsByGroup(groupId): S[Item] = { | |
val stream = sql"select * from items where group = $groupId" | |
.query[Item] |
This file contains 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 javax.crypto.Cipher; | |
import javax.crypto.Mac; | |
import javax.crypto.spec.IvParameterSpec; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.security.MessageDigest; | |
import java.security.SecureRandom; | |
val message = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris commodo tempus pharetra. Sed non fermentum est, id volutpat risus. Sed lobortis et est at faucibus. Sed id leo porttitor, mollis felis id, rutrum est."; | |
val messageBytes = message.getBytes | |
val random = new SecureRandom() |
This file contains 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 PPR(ref, hyp): | |
def find_words_before_commas(tokens): | |
words_before_commas = set() | |
for i, token in enumerate(tokens): | |
if token == "," and i > 0: | |
word = tokens[i-1] | |
words_before_commas.add(word) | |
return words_before_commas |
This file contains 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 scala.xml.XML | |
import scala.xml.{Node => XmlNode} | |
import levsha.Document.Node | |
def nodeFromHtml[T](html: String): Node[T] = Node[T] { rc => | |
val document = XML.loadString(html) | |
def aux(node: XmlNode): Unit = node match { | |
case scala.xml.Text(text) => | |
rc.addTextNode(text) | |
case _ => |
This file contains 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 users = Vector( | |
"@demyanam1", | |
"@CipHuK", | |
"@sergey_samoylov", | |
"@ermakovolegs", | |
"@wouzar", | |
"@_sashashakun", | |
"@myBloodyScala", | |
"@lmnet89", | |
"@laughedelic", |
NewerOlder