Skip to content

Instantly share code, notes, and snippets.

ZIO Contributor License Agreement

Thank you for your interest in contributing to the ZIO open source project.

This contributor agreement ("Agreement") describes the terms and conditions under which you may Submit a Contribution to Us. By Submitting a Contribution to Us, you accept the terms and conditions in the Agreement. If you do not accept the terms and conditions in the Agreement, you must not Submit any Contribution to Us.

This is a legally binding document, so please read it carefully before accepting the terms and conditions. If you accept this Agreement, the then-current version of this Agreement shall apply each time you Submit a Contribution. The Agreement may cover more than one software project managed by Us.

1. Definitions

{
"inbounds": [
{
"tag": "socks-in",
"protocol": "socks",
"listen": "0.0.0.0",
"port": 10708,
"settings": {
"auth": "noauth"
}
@khajavi
khajavi / LoadBalancer.scala
Created October 6, 2025 09:21
Load Balancer with Graceful Shutdown
import zio._
trait LoadBalancer[A] {
def submit(work: A): Task[Unit]
def shutdown: Task[Unit]
def shutdownGracefully(timeout: Duration): Task[Unit]
}
object LoadBalancer {
@khajavi
khajavi / example.yaml
Last active November 4, 2024 05:12
Generate Anki Deck From Directory of Examples
- sentence: "The weather is sort of chilly, but it's not too cold for a walk."
explanation: "This sentence uses 'sort of' to mean it’s a bit chilly but not very cold."
- sentence: "I sort of understand the concept, but I need more practice."
explanation: "Here, 'sort of' implies partial understanding but a need for more clarity."

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x

A sample cla file.

<?xml version="1.0" encoding="UTF-8"?>
<!--Generated by Standards Editor (build:R1.6.16) on 2020 Mar 05 10:41:58, ISO 20022 version : 2013-->
<xs:schema xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.09" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.09">
<xs:element name="Document" type="Document"/>
<xs:complexType name="AccountIdentification4Choice">
<xs:choice>
<xs:element name="IBAN" type="IBAN2007Identifier"/>
<xs:element name="Othr" type="GenericAccountIdentification1"/>
</xs:choice>
</xs:complexType>
object TicTocToe {
sealed trait Action
object Action {
case object X extends Action
case object O extends Action
}
sealed trait Player
object Player {
case object X extends Player
@khajavi
khajavi / Languages.java
Last active February 16, 2020 15:38
How to wrap Java Raw Types in Scala
import java.util.HashSet;
import java.util.Set;
// This is a Java class with wildcards
public class Wild {
Set<?> contents() {
Set<String> languages = new HashSet<>();
languages.add("Scala");
languages.add("Haskell");
languages.add("Closure");
/**
* Represents a mode that decides how to deal exceed rate for Throttle operator
*/
sealed abstract class ThrottleMode
object ThrottleMode {
/**
* Tells throttle to make pauses before emitting messages to meet throttle rate
*/