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
@dacr
dacr / index.md
Last active April 20, 2024 13:35
David's programming examples knowledge base / published by https://github.com/dacr/code-examples-manager #fecafeca-feca-feca-feca-fecafecafeca/211658a4b67b6bf297ce7b4351a7080d22b50ad3

David's programming examples knowledge base

akka-pekko

@ubourdon
ubourdon / ApplyTo.scala
Last active August 29, 2015 14:27
Why have this compilation error & how to fix it
/** In fact I try to write parametric Eventsourcing apply function
* And which allow me to have a parametric function for CommandHandler[D] too.
*/
trait ApplyTo {
def applyTo[E, S](startingState: S)(events: List[E])(implicit de: DomainEvent.Aux[E, S]): S = {
events.foldLeft(startingState) { (currentState, event) => de.apply(currentState, event) }
}
}
@betehess
betehess / ammonite-shapeless
Created May 26, 2015 16:43
Using shapeless to drive Ammonite's PPrinter derivation, used to print shapeless values
> runMain ammonite.repl.Repl
[info] Running ammonite.repl.Repl
Loading Ammonite Repl...
@ load.ivy("com.chuusai" %% "shapeless" % "2.1.0")
@ import shapeless._
import shapeless._
@ 1 :: "lol" :: List(1, 2, 3) :: HNil

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. :)

@edrex
edrex / camlistore-server-vps-s3.md
Last active June 8, 2016 10:12
Camlistore on a VPS with S3 blob storage

Let's set up Camlistore on a Linux server, with blobs stored in s3. This seems to be the currently best-supported option for "cloud" deployment.

This is meant as a supplement to the official server config doc. Read through both docs before you start.

http://camlistore.org/docs/server-config

This blog post is also recommended reading.

I've posted my config files for reference, but they will be created the first time you run camlistored (for the server) and camput init (for the client) so don't copy them.

@huitseeker
huitseeker / Point.scala
Last active December 19, 2015 05:08
Triggering Implicit search by emulating double dispatch using simple dispatch
object Point {
trait PointAdder[P2] {
def add(p2: P2): Point3D
}
case class Point2D(x: Int, y: Int)
case class Point3D(x: Int, y: Int, z: Int)
implicit class Point2Adder(p1:Point2D) extends PointAdder[Point2D] {
@catwell
catwell / active.md
Last active December 21, 2023 09:47
Speakerdecks
;; As a goal
;; Non-relational
;; Accepts these patterns of arguments:
;; IOO
;; III
;; IOI
;; IIO
;; I=input (ground), O=output (not ground)
@gseitz
gseitz / RetroLogger.scala
Created July 22, 2011 21:09
RetroLogger - Bringing old school log level commands to sbt-0.10.x
//
// RetroLogger
// A handy sbt-0.10.x plugin that allows you to set the log level like in the old days (aka sbt-0.7.x)
// "set logLevel := Level.Debug" ====> "debug"
//
// + put this file in ~/.sbt/plugins/
// + add "sbtPlugin := true" to ~/.sbt/plugins/build.sbt
import sbt._
import Keys._
@igstan
igstan / state-monad.coffee
Created April 22, 2011 11:57
State Monad in CoffeeScript
push = (element) -> (stack) ->
newStack = [element].concat stack
{value: element, stack: newStack}
pop = (stack) ->
element = stack[0]
newStack = stack.slice 1
{value: element, stack: newStack}
bind = (stackOperation, continuation) -> (stack) ->