Skip to content

Instantly share code, notes, and snippets.

View MateuszKubuszok's full-sized avatar
🏠
Vacationing from OSS at an actual work

Mateusz Kubuszok MateuszKubuszok

🏠
Vacationing from OSS at an actual work
View GitHub Profile
@MateuszKubuszok
MateuszKubuszok / build.sh
Created July 26, 2018 00:07
Publishing and testing Jekyll sites
#!/bin/bash --login
ThisDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$ThisDir/.."
if [ ! `command -v jekyll > /dev/null` ]; then
rvm use default ruby
bundle install
fi
@MateuszKubuszok
MateuszKubuszok / circe-inmemory-ttfi-di.sc
Last active May 8, 2019 13:24
Showoff code that I probably wouldn't use on production, but looks smarter than whatever stuff is actually required in our everyday coding :P
//
// @author: Mateusz Kubuszok
//
// requirements: ammonite 1.1.0
// usage: run `amm` and copy paste into REPL
import $ivy.`org.typelevel::cats-core:1.3.1`, cats._, cats.syntax.all._
import $ivy.`org.typelevel::cats-effect:1.0.0`, cats.effect._, cats.effect.syntax._
import $ivy.`io.circe::circe-core:0.9.3`, io.circe._, io.circe.syntax._
import $ivy.`io.circe::circe-generic:0.9.3`, io.circe.generic.auto._
implicit final class OptMapOps[A](self: A) {
def optMap[B, C >: A](otherOpt: Option[B])(f: (A, B) => C): C = otherOpt match {
case Some(other) => f(self, other)
case None => self
}
}
// sequence.mapOps(optionalFilter) { case (seq, filter) => filter(seq) }.otherOps(args)
#!/bin/bash
apply1() (
body=$2
block() {
eval "$body"
}
block "$1"
)
// Android
packagingOptions in Android := PackagingOptions(Nil, Nil, Seq("META-INF/NOTICE.txt", "META-INF/LICENSE.txt")),
platformTarget in Android := "android-23",
minSdkVersion in Android := "23",
targetSdkVersion in Android := "23",
debugIncludesTests in Android := false,
dexMulti in Android := true,
typedResources in Android := false,
// Proguard
@MateuszKubuszok
MateuszKubuszok / all.gyp
Created March 2, 2015 10:37
Modified all.gyp (for building target base only)
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
# A hook that can be overridden in other repositories to add additional
# compilation targets to 'All'.
'app_targets%': [],
# For Android-specific targets.
@MateuszKubuszok
MateuszKubuszok / n0s.dat
Created February 4, 2014 15:53
MathProg: calculate mixed strategies Nash equilibrium (any 2 players game)
data;
set P1S := a b c;
set P2S := 1 2 3 4;
param Payoff1
: 1 2 3 4 :=
a 0 3 1 8
b 5 5 4 6
c 2 6 0 5;
@MateuszKubuszok
MateuszKubuszok / 0s.dat
Created February 4, 2014 15:48
MathProg: calculate mixed strategies Nash equilibrium (2 players, 0-sum game)
data;
set P1S := a b c;
set P2S := 1 2 3 4;
param Payoff
: 1 2 3 4 :=
a -5 3 1 8
b 5 5 4 6
c -4 6 0 5;