Skip to content

Instantly share code, notes, and snippets.

View octonato's full-sized avatar

Renato Cavalcanti octonato

View GitHub Profile
@octonato
octonato / gmail-github-filters.md
Created April 8, 2020 10:21 — forked from ldez/gmail-github-filters.md
Gmail and GitHub - Filters

Gmail and GitHub

Create new filters and create new labels.

Pull Request

from:(notifications@github.com) AND {"Patch Links" "approved this pull request." "requested changes on this pull request." "commented on this pull request." "pushed 1 commit." "pushed 2 commits." "pushed 3 commits."}

label: gh-pull-request

package akka.persistence.typed.scaladsl
import akka.actor.typed.Behavior
import akka.persistence.typed.scaladsl.PersistentBehaviors.{CommandHandler, _}
class AccountSpec {
sealed trait AccountCommand
case object CreateAccount extends AccountCommand
case class Deposit(amount: Double) extends AccountCommand
@octonato
octonato / keybase.md
Last active September 26, 2020 07:09

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@octonato
octonato / jvm-env.sh
Last active April 20, 2017 07:27
jvm-env.sh
function jvm.env {
echo "------------------ JVM ENVIRONMENT ------------------"
echo "Sbt options: $SBT_OPTS"
echo "Sbt debug options: $SBT_DEBUG_OPTS"
echo "Java options: $JAVA_OPTS"
echo "Java Home: $JAVA_HOME"
echo "Java Version: "; java -version
echo "-----------------------------------------------------"
echo
/*
Conditional function application.
!!!NOTE!!!
This not equivalent to PartialFunction as it applies a Function from T => T. The intention is to update T, not to transform.
Thus not to be used as replacement of PartialFunction.
Useful when we need to apply different conditional updates and
track if the value was changed or not at the end.
*/
// some experiments for a 'if' replacement for situations where the
// 'else' branche is generified to None or Failure
import scala.util._
import scala.concurrent.Future
class When(cond: => Boolean) {
def apply[T](value: => T): Option[T] = WhenOption.when(cond)(value)
def some[T](value: => T): Option[T] = WhenOption.when(cond)(value)
@octonato
octonato / type-classs-derivation.scala
Created June 11, 2015 16:34
Writer/Reader (Shapeless workshop ScalaDays 2015)
/*
* Copyright (c) 2015 Miles Sabin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@octonato
octonato / TagUntag.scala
Last active August 29, 2015 14:10
Tagger / Untagger
/*
Based on @milessabin's https://gist.github.com/milessabin/89c9b47a91017973a35f
Note the swap: T for Tag and U for Untagged type
*/
type Tag[U, T] = {
type Tag = T
type Untagged = U
}