Skip to content

Instantly share code, notes, and snippets.

View mihaisoloi's full-sized avatar

Mihai Soloi mihaisoloi

  • Bucharest, Romania
View GitHub Profile
@andreisavu
andreisavu / Universe.scala
Created May 8, 2011 13:40
Scala Conway's Game of Life #2
/**
* Conway's Game of Life
*
* @author Andrei Savu <asavu@apache.org>
*/
case class Cell(row: Int, col: Int)
/**
* Unlimited universe for storing a set of cells
@igstan
igstan / MoneyTest.java
Created July 25, 2011 22:26
Force operations on same money currencies in Java at compile time.
package ro.igstan.playground;
import java.util.ArrayList;
import java.util.List;
public class MoneyTest {
public static interface Money<E extends Money<E>> {
public static final class Zero<E extends Money<E>> implements Money<E> {
@Override
@casualjim
casualjim / WebSocketClient.scala
Created February 13, 2012 19:42
A Netty based WebSocket client and server in scala
package mojolly.io
import org.jboss.netty.bootstrap.ClientBootstrap
import org.jboss.netty.channel._
import socket.nio.NioClientSocketChannelFactory
import java.util.concurrent.Executors
import org.jboss.netty.handler.codec.http._
import collection.JavaConversions._
import websocketx._
import java.net.{InetSocketAddress, URI}
@mihaisoloi
mihaisoloi / screenrc
Created June 1, 2012 22:16
screen configuration file
#shell -${SHELL}
defscrollback 2024
startup_message off
#caption always "%{= kc}%H (system load: %l)%3n %t%? @%u%?%? %n(%t) %-21=%{= .m}%D %d.%m.%Y %0c"
hardstatus on
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< %=%D %M %d %c"
#hardstatus string '%{= kc}(system load: %l) %-Lw%{= KW}%50>%n%f %t%{= kK}%+Lw%< %{=kc}%-= %-21=%{= .m}%D %d.%m.%Y %0c'
hardstatus string '%{= kG}(Load: %l) %-Lw%{=b .W}%50>%n%f* %t%{-}%+Lw%< %{=kG}%-= %-21=%{= .G}%D %Y.%m.%d %0c'
#hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
@mihaisoloi
mihaisoloi / gist:2855471
Created June 1, 2012 22:19
conky configuration file
# Use Xft?
use_xft yes
xftfont DejaVu Sans:size=8
xftalpha 0.8
text_buffer_size 2048
# Update interval in seconds
update_interval 1
# This is the number of times Conky will update before quitting.
@VladUreche
VladUreche / gist:8396624
Created January 13, 2014 08:39
Scaladoc tutorial for docs.scala-lang.org, in a pitiful state
# Scaladoc Developer Guide
## Introduction
Scaladoc is the tool that enables developers to automatically generate documentation for their Scala (and Java) projects. It is Scala's equivalent of the widely-used Javadoc tool. This means that Javadoc (and even doxygen) users will be familiar with Scaladoc from day 1: for them, it is most beneficial to check out the Scaladoc/Javadoc comparison tables and if necessary, skim through this document to understand specific features.
The rest of this tutorial is aimed at developers new to Scaladoc and other similar tools. It assumes a basic understanding of the Scala language, which is necessary to follow the examples given throughout the tutorial. For the user perspective on the Scaladoc-generated documentation, such as finding a class, understanding the page layout, navigating through diagrams, please refer to the Scaladoc User Guide.
The tutorial will start by a short motivation and then will explain the main concept in Scaladoc: the doc comment.
### Why document?
@igstan
igstan / decluttered-australis-ui.png
Last active August 29, 2015 14:00
Decluttered UI in Firefox 29
decluttered-australis-ui.png
object NumericOption {
implicit def numericOption[A](implicit N: Numeric[A]): Numeric[Option[A]] =
new Numeric[Option[A]] {
def fromInt(x: Int): Option[A] = Option(N.fromInt(x))
def negate(x: Option[A]): Option[A] = x.map(N.negate(_))
// Not sure whether these should return zero or throw an error...
def toDouble(x: Option[A]): Double = x.map(N.toDouble(_)).getOrElse(0)
def toFloat(x: Option[A]): Float = x.map(N.toFloat(_)).getOrElse(0)
def toInt(x: Option[A]): Int = x.map(N.toInt(_)).getOrElse(0)
@alexandru
alexandru / task-proposal.md
Last active April 1, 2018 14:57
Task: A diverging design from Future and Scalaz Task