Skip to content

Instantly share code, notes, and snippets.

View ahoy-jon's full-sized avatar
🐋
Thinking!

Jonathan Winandy ahoy-jon

🐋
Thinking!
View GitHub Profile
(defrecord Cell [x y])
;; I think it can be better, might be merge with the record
(defn addv [cell dir] (Cell. (+ (:x cell) (first dir)) (+ (:y cell) (second dir))))
(addv (Cell. 1 1) [2 2])
(def initvec [(Cell. 0 0) [0 1] 1])
object EventDef {
class Event(val typee: String)
type State = String
type EventProcessor = PartialFunction[(State, Event), State]
type EventProcessors = Seq[EventProcessor]
@ahoy-jon
ahoy-jon / Point.scala
Last active December 19, 2015 04:49 — forked from fsarradin/Point.scala
object Point extends App {
trait Semigroup[T] {
def append(p1: T, p2: T): T
}
case class Point2D(x: Int, y: Int)
case class Point3D(x: Int, y: Int, z: Int)
object Point2D {
@ahoy-jon
ahoy-jon / Point.scala
Last active December 19, 2015 04:49 — forked from fsarradin/Point.scala
object Point {
trait PointAdder[P1, P2] {
def add(p1: P1, p2: P2): Point3D
}
case class Point2D(x: Int, y: Int)
case class Point3D(x: Int, y: Int, z: Int)
implicit object Point2DAdder extends PointAdder[Point2D, Point2D] {
import shapeless._
object Point extends App {
case class Point3D(x: Int, y: Int, z: Int)
case class Point2D(x: Int, y: Int)
case class Orange(name: String)
case class Apple(name: String)
case class Orple(name: String)
# Last modified: 2011 May 18
# Author: Florian CROUZAT <contact@floriancrouzat.net>
# Feel free to do whatever you want with this file.
# Just make sure to credit what deserve credits.
# Binds {{{
# Prefix
#unbind C-b
#set-option -g prefix C-a
#bind a send-prefix
@ahoy-jon
ahoy-jon / testPickle.scala
Last active December 20, 2015 01:29
working example with Scala Pickling https://github.com/scala/pickling (this doesn't work with Salat (yet))
case class MyEvent1(name:String)
case class MyEvent2(name:String)
case class Domain(t:Product)
object Test extends App {

Pour le lancer depuis vendor :

./deploy_play ../..

This post inspired me : http://www.krisbuytaert.be/blog/docker-vs-reality-0-1 !

When people say real world, they actually mean the sick, bitter and desperate world they imagined for you.

So how to produce "ahoy:234" with "ahoy:" and [1,2,3] ??

The idea [1] is "a program is composed of severals one-liners", lets try to port this one liner into several popular languages. :)

@ahoy-jon
ahoy-jon / ale_blink.erl
Created December 9, 2013 07:58
A way to make a couple of LED Blink for 10 seconds on the Raspberry PI with Erlang.