Skip to content

Instantly share code, notes, and snippets.

View npatarino's full-sized avatar
🔥

Nicolás Patarino npatarino

🔥
View GitHub Profile
colorUserHost="\[\033[01;32m\]"
colorNormal="\[\033[0m\]"
colorFolder="\[\033[01;34m\]"
colorBranch="\[\033[38;5;14m\]"
gitBranch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
branch=$(gitBranch)
override fun all(): Future<List<Either<NetError, Task>>> = Future(async(CommonPool) {
val snapshot: DataSnapshot = suspendCoroutine { cont: Continuation<DataSnapshot> ->
taskReference.addValueEventListener(object : ValueEventListener {
override fun onCancelled(error: DatabaseError) {
cont.resumeWithException(IOException("Error retrieving data"))
}
override fun onDataChange(dataSnapshot: DataSnapshot) {
cont.resume(dataSnapshot)
}
})
@npatarino
npatarino / dstagless.kt
Created May 22, 2018 23:14 — forked from raulraja/dstagless.kt
Tagless data source strategies with Arrow
import arrow.Kind
import arrow.core.Option
import arrow.core.left
import arrow.core.right
import arrow.effects.typeclasses.Async
import arrow.typeclasses.ApplicativeError
data class UserId(val value: String)
data class User(val userId: UserId)
data class Task(val value: String)
interface TasksRepository {
suspend fun tasks(user: User): Either<RepositoryError, List<Task>>
}
fun tasks(tasksRepository: TasksRepository, userRepository: UserRepository):
() -> Either<RepositoryError, List<Task>> = {
runBlocking { tasksRepository.tasks(userRepository.currentUser()) } // This is b
}
UseCase<RepositoryError, List<Task>>().bg(tasks(tasksRepository, userRepository))
@npatarino
npatarino / LambdaWorldPresentation.md
Created November 8, 2017 11:15
Lambda World Presentation

Lambda World Summary

Tasks

  • Resumen del evento (@npatarino y/o @jmdelpozo)
  • Typelevel Unconference (@jdvega y/o rdiaz)
  • Don't fear the monad (@npatarino y/o @jmdelpozo)
  • An introduction to Common Lisp, language, ecosystem and industrial usage (@jdvega y/o rdiaz)
  • Keynote: Category Theory in Life (@jdvega y/o rdiaz)
  • FP Degustation Menu (@jdvega y/o rdiaz)
https://realm.io/products/realm-studio/
build.gradle
classpath "io.realm:realm-gradle-plugin:2.2.1"
app/build.gradle
apply plugin: 'realm-android'
https://github.com/realm/realm-android-adapters/blob/master/example/src/main/java/io/realm/examples/adapters/ui/recyclerview/MyRecyclerViewAdapter.java