Skip to content

Instantly share code, notes, and snippets.

Avatar
🎨
painting boxes

Paco pakoito

🎨
painting boxes
View GitHub Profile
View starship.toml
add_newline = true
[character]
success_symbol = "[ƛ](bold green)"
error_symbol = "[ƛ](bold red)"
[git_branch]
format = ": [$symbol$branch]($style) } "
[java]
View ContextN.kt
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) =
View gist:925dd5b488cd49a77c8de8a21206f58e
data class User(
val name: String
)
interface GetUserService {
fun Id.fetchUser(): User
}
context(Context)
fun makeGetUserService(): GetUserService = object : GetUserService {
@pakoito
pakoito / forge.cmd
Last active Jan 11, 2022
MTG Forge Windows Launcher
View forge.cmd
::@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"
View Advanced-FP-with-Scala.md

Advanced Functional Programming with Scala - Notes

Copyright © 2017 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 =&gt; Int = x =&gt; x * x
View Extract pages from pdf
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
@pakoito
pakoito / ADomainDrivenApproachToKotlinsNewTtypes.kt
Last active Jan 11, 2021
Final code example for "A domain driven approach to Kotlin's new types"
View ADomainDrivenApproachToKotlinsNewTtypes.kt
data class UserInfo(val id: String)
data class UserInfoDto(var id: String?)
// Open Inheritance
interface IViewState { }
class Idle: IViewState
@pakoito
pakoito / TurismoEnUK.txt
Last active Aug 24, 2019
Turismo en UK
View TurismoEnUK.txt
LONDON
===
South Bank
Millenium Bridge
Blackfriars Bridge
Tower Bridge
Tower of London
Trafalgar Square
Rascacielos de Bank y Shoredich
Soho
View learn.lua
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------