Skip to content

Instantly share code, notes, and snippets.

@evacchi
evacchi / grandchild.scala
Last active January 4, 2016 10:00
Scala-Prolog
trait John
trait Carl
trait Tom
trait Child[T,U]
trait GrandChild[T,U]
implicit val john_carl = new Child[John,Carl]{}
implicit val carl_tom = new Child[Carl,Tom ]{}
implicit def grandChild[X,Y,Z](
@raelg
raelg / gist:e12d731ba01ba58f0006
Created January 20, 2015 16:44
Scala Gson Serializer
package services
import java.lang.reflect.Type
import com.google.gson._
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{DateTime, DateTimeZone}
object Serializers {
@js1972
js1972 / testing.sc
Created August 16, 2014 08:22
Monoid implementation for Double. From ScalaZ 7.1 Double and Float are no longer supported as they don't totally fulfill the Monoid laws.
package com.example
import scalaz._
import Scalaz._
object testing {
1 |+| 1 //> res0: Int = 2
@j5ik2o
j5ik2o / hoge.md
Last active December 25, 2015 19:29
val service = new Service[HttpRequest, HttpResponse] {
  def apply(request: HttpRequest) =
    Future(new DefaultHttpResponse(HTTP_1_1, OK))
}

val server: Server = ServerBuilder()                                                       // 4
  .codec(Http())
  .bindTo(new InetSocketAddress(8080))
  .name("HttpServer")
@pies
pies / ExcelFormulas.js
Created November 29, 2012 04:55
Few Excel formulas - PMT, PPMT, XIRR - expressed in Javascript
/* Based on
* - EGM Mathematical Finance class by Enrique Garcia M. <[email protected]>
* - A Guide to the PMT, FV, IPMT and PPMT Functions by Kevin (aka MWVisa1)
*/
var ExcelFormulas = {
PVIF: function(rate, nper) {
return Math.pow(1 + rate, nper);
},
@rajraj
rajraj / es.sh
Created January 3, 2012 20:07 — forked from aaronshaf/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share