Skip to content

Instantly share code, notes, and snippets.

Junichi Kato j5ik2o

Block or report user

Report or block j5ik2o

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sourcebatch.scala
object TestMain extends App {
import akka.stream.scaladsl._
import akka.actor._
import akka.stream.ActorMaterializer
import scala.concurrent._
import scala.concurrent.duration._
implicit val system = ActorSystem()
implicit val ec = system.dispatcher
implicit val mat = ActorMaterializer()
View gist:2548150ae06956209bd619f5cdbe6864
curl -v -X GET https://oss.sonatype.org/content/repositories/releases/com/github/j5ik2o/reactive-redis-core_2.12/1.0.20/reactive-redis-core_2.12-1.0.20.pom                        INT(-2) ↵  3243  22:31:44
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 23.22.160.79...
* TCP_NODELAY set
* Connected to oss.sonatype.org (23.22.160.79) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
View btree.go
package btree
package btree
type Node interface {
Size() int
Sum() int64
Min() int64
Max() int64
Find(value int64) *int64
View BTree.rs
trait BTree {
fn size(&self) -> i32;
fn sum(&self) -> i64;
fn min(&self) -> i64;
fn max(&self) -> i64;
fn find(&self, value: i64) -> Option<i64>;
}
enum Node {
Leaf {
View ImmutablePaint.java
// 絵の具を表すオブジェクト(副作用が伴う可変オブジェクト)
public class Paint {
private int volume;
private PigmentColor pigmentColor;
// getter, setter 省略
public Paint(PigmentColor pigmentColor, int volume) {
this.volume = volume;
this.pigmentColor = pigmentColor;
}
View ImmutableMoney.scala
case class Money(amount: BigDecimal,
currency: Currency) {
def plus(other: Money): Money = {
require(currency == other.currency)
new Money(amount = amount.add(other.amount), currency)
}
}
View UserAccount.scala
case class UserAcount(id: Long, name: String, groupId: Long) {
// ...
def groupName(groupRepository: GroupRepository): Task[GroupName] = groupRepository.resolveBy(groupId).map(_.name)
}
View Money.scala
package domain
trait Money {
def plus(other: Money): Money
def minus(other: Money): Money
// ...
}
View ApiServer.scala
class ApiServer extends HttpApp {
protected val design: Design = bind[Design] // ApiServerの外部で定義されているDesginを参照したい
.bind[AtomicReference[ActorSystem]]
.toInstance(systemReference)
.bind[ActorSystem]
.toInstanceProvider[AtomicReference[ActorSystem]](_.get)
// snip
You can’t perform that action at this time.