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
using System; | |
using FPCSharpUnity.core.dispose; | |
using Quantum.Game.extensions; | |
namespace Quantum; | |
/// <summary> | |
/// <para>Read-only interface for <see cref="CallbackDispatcher"/>.</para> | |
/// | |
/// <para> |
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 src = """ | |
Card Transaction | |
CRV*UAB ABUNDO, Vilnius, LT CD 0108 2022/01/12, 18:26 - €1.5 | |
""" | |
import java.time.LocalDateTime | |
val Re = """^(.*?)(\d{4})/(\d\d)/(\d\d),\s*(\d\d):(\d\d)\s*(-)?\s*€([\d\\.]+)$""".r | |
val amounts = src.linesIterator.sliding(2).withPadding("").flatMap { case Seq(prevLine, line) => | |
if ( | |
line.contains("Card Deposit") |
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
using System; | |
using JetBrains.Annotations; | |
namespace FPCSharpUnity.core.functional.higher_kinds; | |
/// <summary> | |
/// As <see cref="Func{A,B}"/>, but transforms the functor W1[_] to W2[_], instead of transforming the value. | |
/// </summary> | |
[PublicAPI] public interface FuncK<W1, W2> { | |
HigherKind<W2, A> apply<A>(HigherKind<W1, A> value); |
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
package app.implicit_constraints | |
object Bounds1 { | |
case class Container[A](a: A) | |
implicit class IntContainerExtensions(container: Container[Int]) { | |
def addWithExtension(other: Int): Int = container.a + other | |
} | |
val intContainer: Container[Int] = Container(5) |
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 jsEncoder[A](implicit w: Writes[A @@ SerializedInDB]): Encoder[A] = encoder[A]( | |
java.sql.Types.OTHER, | |
(index: Index, value: A, row: PrepareRow) => | |
row.setObject(index, writeJS(value), java.sql.Types.OTHER) | |
) | |
def jsOptEncoder[A](implicit w: Writes[A @@ SerializedInDB]): Encoder[Option[A]] = encoder[Option[A]]( | |
java.sql.Types.OTHER, | |
(index: Index, maybeValue: Option[A], row: PrepareRow) => { | |
val json = maybeValue.fold2(null, a => writeJS(a)(w)) |
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
// See Utilities.SetWindowTitle.cs for explanation | |
#if UNITY_EDITOR_WIN || (UNITY_STANDALONE_WIN && !UNITY_EDITOR) | |
using System; | |
using System.Runtime.InteropServices; | |
using FPCSharpUnity.unity.Logger; | |
using FPCSharpUnity.unity.Utilities; | |
using GenerationAttributes; | |
using FPCSharpUnity.core.exts; | |
using FPCSharpUnity.core.log; | |
using static FPCSharpUnity.unity.win32_api.Win32API; |
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
// ReSharper disable all | |
using System; | |
namespace Quantum | |
{ | |
public partial struct AbilityTargetData | |
{ | |
public static AbilityTargetData newCharacter(EntityRefCharacter _character) | |
{ | |
var data = default(AbilityTargetData); |
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
using System; | |
using JetBrains.Annotations; | |
using pzd.lib.data; | |
using pzd.lib.exts; | |
namespace pzd.lib.functional { | |
/// <summary> | |
/// Allows encapsulating side effects and composing them. | |
/// </summary> | |
// ReSharper disable once UnusedTypeParameter |
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
for (final kv in accounts.entries) { | |
kv.value.details.owner.iswitch( | |
me: () {}, | |
otherUser: (userId) { | |
otherUsers | |
.getE(userId) | |
.fold((err) => errors.add(StateUpdateError.withoutEvent(err)), | |
(events) { | |
final accountId = kv.key; | |
if (!events.share.rules.isShared(accountId)) { |
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
// Pre copy-paste | |
getAccount(accountId) | |
.filterMap((account) => | |
account.details.owner != modifier | |
? Some( | |
"Can't modify a transaction $eventToModifyRef in account $accountId that you don't own: " | |
"owner=${account.details.owner}, modifier=$modifier" | |
) | |
: const Option.none() | |
) |