Skip to content

Instantly share code, notes, and snippets.

Avatar

Denys Shabalin densh

  • Zurich, Switzerland
View GitHub Profile
View spec-sharing.txt
# cat src/main/scala/Hello.scala
object Foo {
val a: Int = a
val b: Boolean = b
val c: Char = c
val d: String = d
}
object Test extends App {
println(Foo.a)
@densh
densh / hello-cpp.txt
Created Oct 3, 2018
Hello World size of SN vs statically linked C++
View hello-cpp.txt
# cat main.cpp
#include <stdio.h>
int main() {
printf("hello, world!");
return 0;
}
# clang++ -c -Os main.cpp
View scala-native-webserver-benchmark.txt
# ab -n 10000 "http://127.0.0.1:7000/"
This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
View SnakeStream.scala
import scalanative.native._
import SDL._
import SDLExtra._
@extern
@link("SDL2")
object SDL {
type Window = CStruct0
type Renderer = CStruct0
@densh
densh / Snake.scala
Last active Apr 14, 2020
Snake game in 200 lines of Scala Native and SDL2 as demoed during Scala Matsuri 2017
View Snake.scala
import scalanative.native._
import SDL._
import SDLExtra._
@extern
@link("SDL2")
object SDL {
type Window = CStruct0
type Renderer = CStruct0
@densh
densh / scoped-implicit-lifetimes.md
Last active Oct 18, 2020
Scoped Implicit Lifetimes
View scoped-implicit-lifetimes.md

Scoped Implicit Lifetimes

All things considered, our experience in Scala Native has shown that resource management in Scala is way harder than it should be. This gist presents a simple design pattern that makes it resource management absolutely hassle-free: scoped implicit lifetimes.

The main idea behind it is to encode resource lifetimes through a concept of an implicit scope. Scopes are necessary to acquire resources. They are responsible for disposal of the resources once the evaluation exits the

@densh
densh / keybase.md
Created Jan 26, 2016
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am densh on github.
  • I am den_sh (https://keybase.io/den_sh) on keybase.
  • I have a public key whose fingerprint is A7EB 371C E36F C968 528A 912E 4464 3DC9 4CC7 8F40

To claim this, I am signing this object: