Skip to content

Instantly share code, notes, and snippets.

View lucasrpb's full-sized avatar
🎯
Focusing

Lucas Batistussi lucasrpb

🎯
Focusing
View GitHub Profile
package main
import (
"fmt"
)
type Mutator interface {
Change()
AnotherChange()
}
package main
import (
"fmt"
"math"
"time"
)
type Receiver interface {
Receive(data interface{})
package main
import (
"fmt"
"runtime"
)
func catchPanic(err *error, functionName string) {
// recover gets the last panic
package main
import (
"fmt"
)
type Action struct {
Next interface{}
f func()
}
object Main {
trait A {
val age = 18
}
trait B {
val name = "Lucas"
}
@lucasrpb
lucasrpb / factorial.asm
Created January 4, 2017 18:59
MIPS Assembly
.data ## Data declaration section
## String to be printed:
prompt: .asciiz "Enter a non-negative number:\n"
result: .asciiz "\nThe factorial is: "
.text
main:
li $v0, 4
la $a0, prompt
syscall
@lucasrpb
lucasrpb / SimpleHttpServer.java
Created March 2, 2017 02:49 — forked from travisbrown/SimpleHttpServer.java
A very simple Finagle HTTP server example (no error handling, etc.)
import com.twitter.finagle.Http;
import com.twitter.finagle.ListeningServer;
import com.twitter.finagle.Service;
import com.twitter.finagle.http.HttpMuxer;
import com.twitter.util.Await;
import com.twitter.util.Future;
import java.net.InetSocketAddress;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.jboss.netty.buffer.ChannelBuffers.copiedBuffer;
import org.jboss.netty.handler.codec.http.*;
@lucasrpb
lucasrpb / vector_clock.go
Last active March 5, 2017 01:10
vector_clock.go
package main
import (
"fmt"
"time"
)
type VectorClock struct {
values map[string]int64
}
class Test {
private var y = 0
def x = y
def x_=(v: Int) = y = v
}
val test = new Test()
test.x = 12
import org.scalatest.FlatSpec
import scala.concurrent.{Await, Future, Promise}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
class MainSpec extends FlatSpec {
"accounts balances" should "be equal before and after transfers" in {