Skip to content

Instantly share code, notes, and snippets.

@dcsobral
dcsobral / README.md
Created April 15, 2020 23:40
Scala Configurable Warnings

Pull request #8373 implementing issue 333 (but please note differences).

Pull request description follows:

This PR adds a -Wconf compiler flag that allows filtering and configuring compiler warnings (silence them, or turn them into errors).

It also integrates the fantastic silencer compiler plugin by @ghik into the compiler, which allows suppressing warnings locally using the @nowarn annotation.

Прикиньте как к с Дру играть в шахматы.
- Это не мат. Даже если это мат, я могу продолжать.
- И что что ты сказал "мат", это оценочное суждение.
- Нет мат это не проигрыш, иначе он бы назывался "проигрыш", а не мат.
- Включи мозг, очевидно, что мат это один из двух состояний игры "Шах" и "Мат".
- Мат это просто очень серьезный шах.
- Да завершился взятием короля. И что?
- Ты просто убил моего короля, причем тут проигрыш?
- Нет не проиграл, я просто пожертвовал фигуру.
@DamianReeves
DamianReeves / build.gradle
Last active April 21, 2022 15:11
Using Scala Compiler Plugins From Gradle
plugins {
id 'scala'
}
configurations {
scalaCompilerPlugin
}
dependencies {
@dadhi
dadhi / Lens.cs
Last active February 23, 2024 09:41
Functional optics, e.g. Lens, in C# - to simplify access and modification for deep part of immutable value
/*
Inspired by: https://medium.com/@gcanti/introduction-to-optics-lenses-and-prisms-3230e73bfcfe
*/
using System;
using static System.Console;
public static class Program
{
public static void Main()
@shinnya
shinnya / Main.scala
Last active March 20, 2018 21:37
An example of FP testing using Continuation
import scala.concurrent.Await
import scala.concurrent.Future
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.language.higherKinds
import scalaz.ContT
import scalaz.std.scalaFuture.futureInstance
object Main {
import cats.data.ReaderT
import cats.implicits.{catsStdInstancesForFuture, _}
import cats.{Applicative, Monad}
import scala.concurrent.ExecutionContext.global
import scala.concurrent.duration._
import scala.concurrent.{Await, ExecutionContext, Future}
object Foo extends App {
@paulp
paulp / sbt-with-coursier.sh
Last active March 30, 2017 07:58
sbt from zero to shell in 39s.
#!/usr/bin/env bash -x
#
# Invoke sbt starting with no local jars, using coursier.
shopt -s globstar
set -euo pipefail
cpof() {
find "$@" -iname '*.jar' -o -iname '*.zip' | paste -sd: -
}
// http://underscore.io/blog/posts/2015/04/14/free-monads-are-simple.html
// updated version for scalaz 7.2.x where Free automatically applies the
// Coyoneda transform
import scalaz.{Free, ~>, Id}
import scalaz.std.list._
import scalaz.syntax.traverse._
type UserId = Int
type UserName = String
@mingfang
mingfang / convert id_rsa to pem
Last active July 20, 2024 14:14
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 600 id_rsa.pem
@chaotic3quilibrium
chaotic3quilibrium / DIY Scala Enumeration - README.txt
Last active September 13, 2020 22:20
DIY Scala Enumeration (closest possible Java Enum equivalent with guaranteed pattern matching exhaustiveness checking)
README.txt - DIY Scala Enumeration
Copyright (C) 2014-2016 Jim O'Flaherty
Overview:
Provide in Scala the closest equivalent to Java Enum
- includes decorating each declared Enum member with extended information
- guarantees pattern matching exhaustiveness checking
- this is not available with scala.Enumeration
ScalaOlio library (GPLv3) which contains more up-to-date versions of both `org.scalaolio.util.Enumeration` and `org.scalaolio.util.EnumerationDecorated`: