Skip to content

Instantly share code, notes, and snippets.

Artūras Šlajus arturaz

Block or report user

Report or block arturaz

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
@arturaz
arturaz / gist:80cf15617aa4c83b719933958b5b4ec4
Created Jul 21, 2019
Windows API (Win32) to flash (blink) the taskbar window in Unity
View gist:80cf15617aa4c83b719933958b5b4ec4
https://github.com/tinylabproductions/tlplib/commit/3d96ea5e6d90d168ea41bc0d2470c7b2d86b74b0
@arturaz
arturaz / InteractiveBrokersDividends.scala
Created Apr 22, 2019
Little scala script for calculating the dividends and withholdings for them for InteractiveBrokers platform
View InteractiveBrokersDividends.scala
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Path, Paths}
case class Identifier(ticker: String, isin: String)
val DescriptionRe = """^(.+?)\s*\((.+?)\).*$""".r
def read(path: Path): Map[Identifier, Vector[BigDecimal]] = {
val lines = Files.readAllLines(path, StandardCharsets.UTF_8)
var map = Map.empty[Identifier, Vector[BigDecimal]].withDefaultValue(Vector.empty)
@arturaz
arturaz / Conversions.cs
Created Apr 6, 2019
JVM and .NET compatible GUID usable in Unity that can be converted back and forth without any allocations.
View Conversions.cs
using com.tinylabproductions.TLPLib.Data;
using Quantum;
namespace Game.code.quantum_bind {
public static class Conversions {
public static unsafe QGuid toQGuid(this SerializableGUID guid) {
var srcBytes = stackalloc byte[16];
var dstBytes = stackalloc byte[16];
*((ulong*) srcBytes) = guid.long1;
*((ulong*) (srcBytes + 8)) = guid.long2;
View Example.cs
// photon does not serialize ulong by default
public static readonly IPhotonProperty<QGuid> PROP_USER_ID =
PhotonProperty.a(new TypedKey<long>("UserId_p0"))
.add(
PhotonProperty.a(new TypedKey<long>("UserId_p1")),
(l1, l2) => new QGuid((ulong) l1, (ulong) l2),
id => (long) id.long1,
id => (long) id.long2
);
View kaunas-jug.txt
### Why
* programmers are religious people
* people seem hostile to new ideas
* "it worked for me before, why change?"
- HomeToGo JS vs TS
- JUG vs FP
### What
@arturaz
arturaz / shapeless-test.scala
Created Dec 17, 2018
Playing around with shapeless
View shapeless-test.scala
package app
import shapeless.ops.hlist.{ConstMapper, Intersection, Union, ZipWith}
import shapeless.{::, HList, HNil, Poly2}
case class Params()
sealed trait EvaluatableGeneratorFilter[+Result] {
def eval(p: Params): Result
}
View shapeless.scala
package app
import shapeless.ops.hlist.{ConstMapper, Mapper, ZipWith}
import shapeless.{::, HList, HNil, Poly2}
case class Params()
sealed trait EvaluatableGeneratorFilter[+Result] {
def eval(p: Params): Result
}
View code.scala
package app
import shapeless.ops.hlist.Mapper
import shapeless.{::, HList, HNil, Poly2}
case class Params()
sealed trait EvaluatableGeneratorFilter[+Result] {
def eval(p: Params): Result
}
View EitherUtils.scala
package app.utils
import scala.collection.generic.CanBuildFrom
import scala.language.higherKinds
object EitherUtils {
def sequence[
OuterTraversable[X1] <: TraversableOnce[X1],
InnerTraversable[X2] <: TraversableOnce[X2],
A, B
View board.cs
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using com.tinylabproductions.TLPLib.Collection;
using com.tinylabproductions.TLPLib.Data;
using com.tinylabproductions.TLPLib.Extensions;
using com.tinylabproductions.TLPLib.Functional;
using com.tinylabproductions.TLPLib.Utilities;
You can’t perform that action at this time.