Skip to content

Instantly share code, notes, and snippets.

@pchiusano
pchiusano / Interpreters.scala
Created September 21, 2017 20:51
Code for Scala World 2017 talk on eliminating interpreter overhead via partial evaluation
package scalaworld.interpreters
/*
This file shows a simple language, an interpreter, and two
partial evaluators for that language, along with a profiling suite.
*/
trait Expr // denotes a Vector[Double] => Vector[Double]
object Expr {
@mpilquist
mpilquist / switchMap.scala
Created March 18, 2017 17:13
FS2 version of switchMap
def switchMap[F[_]: Async, A, B](f: A => Stream[F, B]): Pipe[F, A, B] = {
def go(
outer: ScopedFuture[F, Pull[F, Nothing, (NonEmptyChunk[A], Handle[F, A])]],
inner: ScopedFuture[F, Pull[F, Nothing, (NonEmptyChunk[B], Handle[F, B])]]
): Pull[F, B, Nothing] = {
(outer race inner).pull.flatMap {
case Left(outer) =>
outer.optional.flatMap {
case None =>
inner.pull.flatMap(identity).flatMap { case (hd, tl) => Pull.output(hd) >> tl.echo }
@viktorklang
viktorklang / Gistard.scala
Last active June 9, 2017 07:27
Gistard — an sbt autoplugin for depending on Gists — such as Gistard itself
/*
Copyright 2015 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@johnynek
johnynek / AliceInAggregatorLand.scala
Last active January 24, 2024 19:38
A REPL Example of using Aggregators in scala
/**
* To get started:
* git clone https://github.com/twitter/algebird
* cd algebird
* ./sbt algebird-core/console
*/
/**
* Let's get some data. Here is Alice in Wonderland, line by line
*/
@jdegoes
jdegoes / book-outline.md
Created October 6, 2014 23:24
Enterprise Scala

Enterprise Scala

A guide to writing high-performance, robust, Enterprise-grade Scala applications.

Scala is a new language for the JVM that is rapidly spreading beyond tech companies like Twitter, Netflix, and LinkedIn, and into large Enterprises. Engineering teams in companies of all types and sizes are turning to Scala for its strong type system, its extensive ecosystem (Scalaz, Shapeless, Spire), and its seamless interoperability with legacy Java code bases.

While there are many books geared at introducing developers to the Scala programming language, none specifically address the question of what it means to write idiomatic Scala in today’s modern Enterprise. As a large, complex language with many advanced features, there are many ways to write Scala apps, and not all of them were created equal.

Enterprise Scala is the first book to systematize decades of real world, production experience writing large-scale, Enterprise-grade systems in Scala. The result is a comprehensive overview of what idioma

@staltz
staltz / introrx.md
Last active May 7, 2024 09:38
The introduction to Reactive Programming you've been missing
@kevinwright
kevinwright / scaladays2014.md
Last active March 8, 2018 20:25
Scaladays 2014 slides

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

@runarorama
runarorama / gist:a8fab38e473fafa0921d
Last active April 13, 2021 22:28
Compositional application architecture with reasonably priced monads
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&rep=rep1&t
@pozorvlak
pozorvlak / crdt.md
Last active February 7, 2021 01:36
CvRDTs are almost as general as they can be.

CvRDTs are (almost?) as general as they can be

What are you talking about, and why should I care?

Now that we live in the Big Data, Web 3.14159 era, lots of people want to build databases that are too big to fit on a single machine. But there's a problem in the form of the CAP theorem, which states that if your network ever partitions (a machine goes down, or part of the network loses its connection to the rest) then you can keep consistency (all machines return the same answer to