Skip to content

Instantly share code, notes, and snippets.

Avatar
👁️‍🗨️

federico silva fedesilva

👁️‍🗨️
View GitHub Profile
@OlegIlyenko
OlegIlyenko / SangriaReproExample.scala
Last active Oct 25, 2019
An example of minimal self-contained snippet that reproduces specific issue
View SangriaReproExample.scala
// Imports that you are using
import sangria.schema._
import sangria.execution._
import sangria.macros._
import sangria.marshalling.circe._
import scala.concurrent.ExecutionContext.Implicits.global
// The schema definition
@MateuszKubuszok
MateuszKubuszok / circe-inmemory-ttfi-di.sc
Last active May 8, 2019
Showoff code that I probably wouldn't use on production, but looks smarter than whatever stuff is actually required in our everyday coding :P
View circe-inmemory-ttfi-di.sc
//
// @author: Mateusz Kubuszok
//
// requirements: ammonite 1.1.0
// usage: run `amm` and copy paste into REPL
import $ivy.`org.typelevel::cats-core:1.3.1`, cats._, cats.syntax.all._
import $ivy.`org.typelevel::cats-effect:1.0.0`, cats.effect._, cats.effect.syntax._
import $ivy.`io.circe::circe-core:0.9.3`, io.circe._, io.circe.syntax._
import $ivy.`io.circe::circe-generic:0.9.3`, io.circe.generic.auto._
@jkachmar
jkachmar / Main.hs
Last active Mar 17, 2020
Just Do the Right Thing
View Main.hs
module Main where
--------------------------------------------------------------------------------
-- | This is the `Maybe` data type:
-- |
-- | > data Maybe a
-- | > = Nothing
-- | > | Just a
-- |
-- | `Maybe` is a sum type that can be parameterized over a given `a` type, such
View disable-xdebug.sh
#!/bin/sh
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
sudo brew services restart php71
echo "xdebug disabled"
@fedesilva
fedesilva / 0introduction.md
Created Apr 5, 2016 — forked from djspiewak/0introduction.md
Scala Collections Proposal
View 0introduction.md

Collections Redesign Proposal

I'm going to start off by motivating what I'm doing here. And I want to be clear that I'm not "dissing" the existing collections implementation or anything as unproductively negative as that. It was a really good experiment, it was a huge step forward given what we knew back in 2.8, but now it's time to learn from that experiment and do better. This proposal uses what I believe are the lessons we can learn about what worked, what didn't work, and what is and isn't important about collections in Scala.

This is going to start out sounding really negative and pervasively dismissive, but bear with me! There's a point to all my ranting. I want to be really clear about my motivations for the proposal being the way that it is.

Problems

Generic Interfaces

@djspiewak
djspiewak / streams-tutorial.md
Created Mar 22, 2015
Introduction to scalaz-stream
View streams-tutorial.md

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca

@bantonsson
bantonsson / FormUpload.scala
Created Mar 3, 2015
Akka HTTP 1.0-M4 File upload using a form
View FormUpload.scala
/*
* Copyright (C) 2009-2015 Typesafe Inc. <http://www.typesafe.com>
*/
import akka.actor.ActorSystem
import akka.http.Http
import akka.http.Http.IncomingConnection
import akka.http.model.HttpEntity
import akka.http.model.Multipart.FormData
import akka.http.server.{ Directives, Route, RoutingSetup }
@kelseyq
kelseyq / gist:d4a2c73a41609c563ad1
Last active Jan 24, 2016
witchy ScalaCheck examples
View gist:d4a2c73a41609c563ad1
import org.scalacheck.Prop.forAll
import org.scalacheck.Properties
object ShakespeareSpec extends Properties("Bubble") {
def spell(words: List[String], mysticNumber: Int) =
mysticNumber.toString +
words.mkString + "toil" + "trouble"
property("bubble") = forAll { (a: List[String], b: Int) =>
View FoldingViews.scala
package scalax.collection
import scala.collection.mutable.ListBuffer
/** FoldTransformers and the views based on them are a Scala
* adaptation, and to some degree an extension, of Rich Hickey's
* transducers for Clojure. They show that the concepts can be
* implemented in a type-safe way, and that the implementation is
* quite beautiful.
*/
object FoldingViews {
@kachayev
kachayev / concurrency-in-go.md
Last active Apr 10, 2022
Channels Are Not Enough or Why Pipelining Is Not That Easy
View concurrency-in-go.md