This file contains hidden or 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
| add_newline = true | |
| [character] | |
| success_symbol = "[ƛ](bold green)" | |
| error_symbol = "[ƛ](bold red)" | |
| [git_branch] | |
| format = ": [$symbol$branch]($style) } " | |
| [java] |
This file contains hidden or 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
| inline fun <A, T> withN(t: T, f: context(T) () -> A) = | |
| with(t) { f() } | |
| inline fun <A, T, U> withN(t: T, u: U, f: context(T, U) () -> A) = | |
| with(t) { with(u) { f() } } | |
| inline fun <A, T, U, V> withN(t: T, u: U, v: V, f: context(T, U, V) () -> A) = | |
| with(t) { with(u) { with(v) { f() } } } | |
| inline fun <A, T, U, V, W> withN(t: T, u: U, v: V, w: W, f: context(T, U, V, W) () -> A) = |
This file contains hidden or 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
| data class User( | |
| val name: String | |
| ) | |
| interface GetUserService { | |
| fun Id.fetchUser(): User | |
| } | |
| context(Context) | |
| fun makeGetUserService(): GetUserService = object : GetUserService { |
This file contains hidden or 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
| ::@echo off | |
| pushd %~dp0 | |
| java -version 1>nul 2>nul || ( | |
| echo no java installed | |
| popd | |
| exit /b 2 | |
| ) | |
| for /f tokens^=2^ delims^=.-_^+^" %%j in ('java -fullversion 2^>^&1') do set "jver=%%j" |
This file contains hidden or 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
| pdfx() { | |
| name=$(basename $3 .pdf) | |
| for i in {0..$(expr $(vipsheader -f pdf-n_pages $3) - 1)}; do | |
| noglob vips copy $3[dpi=$1,page=$i] $(realpath $2)/$name-$(expr $i + 1)@$1.jpg; | |
| done | |
| } | |
| # cmd dpi outdir infile | |
| # pdfx 300 ./out mypdf.pdf |
This file contains hidden or 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
| private fun loggedInMenuUi(menu: Menu, rootView: View, checkoutCartStream: Stream<Bla>, startActivity: () -> Unit) { | |
| val alertMenuItem = menu.findItem(R.id.activity_main_alerts_menu_item) | |
| val rootView = (alertMenuItem.actionView as FrameLayout).apply { | |
| setOnClickListener { | |
| startActivity() | |
| } | |
| } | |
| val redCircle: FrameLayout = rootView.findViewById(R.id.view_alert_red_circle) |
This file contains hidden or 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
| when (info) { | |
| null -> { | |
| return unauthorized() | |
| } | |
| else -> { | |
| val validInfo = validator.validateInfo(info) | |
| when (validInfo) { | |
| is Either.Right -> { | |
| if (!validInfo.b.authorised) { |
This file contains hidden or 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
| const Day = ({ get, left, right }) => { | |
| const map = f => Day ({ | |
| get: f (extract()), | |
| left, right | |
| }) | |
| const extend = f => | |
| Day ({ | |
| get: (left, right) => f (Day ({ get, left, right })), |
This file contains hidden or 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
| import arrow.core.* | |
| import arrow.data.k | |
| import arrow.syntax.applicative.tupled | |
| import arrow.syntax.functor.map | |
| import arrow.typeclasses.binding | |
| typealias IntFunction = (Int) -> Int | |
| fun IntFunction.map(g: IntFunction) = { it: Int -> this(g(it)) } |