Skip to content

Instantly share code, notes, and snippets.

View eparejatobes's full-sized avatar

Eduardo Pareja Tobes eparejatobes

View GitHub Profile
@knshiro
knshiro / release.sbt
Last active June 1, 2016 22:08
Make sbt-release work with sbt-git versioning.
import sbtrelease._
import ReleaseKeys._
import Utilities._
import ReleaseStateTransformations._
val gitVersionString = """enablePlugins(GitVersioning)
git.baseVersion := "%s""""
def writeVersion(st: State, versionString: String) {
@non
non / transducers.scala
Created October 30, 2014 00:39
Slightly simpler example of typed transducers in Scala. See http://blog.podsnap.com/ducers2.html for more context.
object Transducer {
type RF[R, A] = (R, A) => R
def apply[A, B](f: A => B) =
new Transducer[B, A] {
def apply[R](rf: RF[R, B]) = (r, a) => rf(r, f(a))
}
}
import Transducer.RF
@milessabin
milessabin / gist:2500326
Created April 26, 2012 15:22
Scala collection extension methods made easy (dependent types FTW!)
/*
* Copyright (c) 2012 Miles Sabin
*
* 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
@travisbrown
travisbrown / kata-bank-ocr.scala
Created September 21, 2012 18:09
KataBankOCR checksum at the type level
/**
* We can use the Scala type system (with help from Miles Sabin's Shapeless
* library) to solve the bank account number validation problem in the second
* user story of the KataBankOCR kata on Coding Dojo:
*
* http://codingdojo.org/cgi-bin/wiki.pl?KataBankOCR
*
* By Travis Brown in response to a question by Paul Snively on the Shapeless
* Dev mailing list:
*
@newlandsvalley
newlandsvalley / index.scala.html
Created March 7, 2016 19:18
Simple integration of elm with the Play Framework (Scala)
@*
* This template takes a single argument, a String containing a
* message to display.
*@
@(message: String)
@main("The Interactive ABC Tutorial", "abc", "Main") {
<h1>The Interactive ABC Tutorial</h1>
@non
non / cost.md
Last active January 16, 2019 17:12
Basic explanation of the difference between Machinist's macros and value classes.

Introduction

Machinist Issue #2 asks:

Is it correct, that this stuff is completely obsolete now due to value classes or are there still some use cases? An example of using value class for zero-cost implicit enrichment: [...]

The short answer is that Machinist is not obsolete: value classes existed before the Machinist macros were implemented, and they do not solve the

@smarter
smarter / projection-proposal.md
Created January 5, 2016 12:49
Type projection proposal

NOTE: This is a sketch of the proposal, many details need to be filled out and the scheme hasn't been implemented yet.

G |- T <: S
--------------------
G |- T#L <: S#L

------------------------------
G |- {L: X..Y, ...}#L <: Y
@chrisjacob
chrisjacob / README.md
Created March 24, 2011 14:20
QUICK setup Github Pages + Cloud9 IDE for HTML/CSS/JavaScript hacking

QUICK setup Github Pages + Cloud9 IDE for HTML/CSS/JavaScript hacking

GitHub + GitHub Pages

  1. Get a GitHub account: https://github.com/
  2. Github > Dashboard > New Repository ... https://github.com/repositories/new
  3. Enter a Project Name and Description; click "Create Repository"
  4. On the project page ignore the suggested setup instructions... instead click on the "Admin" button
  5. Check the "GitHub Pages" checkbox... You'll get a popup.
  6. Click the "Automatic GitHub page Generator" button.
  7. Choose a funky colour... or go safe with just white... then click "Create Page" button
@fanf
fanf / DependencyInjection.scala
Created July 18, 2013 16:06
Simple, Static Scala dependency injection with Shapeless
package test_shapeless
object DI {
import shapeless._
trait Injecter[L <: HList, A] {
def apply(l: L) : A
}
trait InjecterAux[L <: HList, A] {
@scotu
scotu / solarized.css
Created October 8, 2011 18:27 — forked from tdreyno/solarized.css
Solarized Light Pygments CSS
.highlight { background-color: #ffffcc }
.highlight .c { color: #586E75 } /* Comment */
.highlight .err { color: #93A1A1 } /* Error */
.highlight .g { color: #93A1A1 } /* Generic */
.highlight .k { color: #859900 } /* Keyword */
.highlight .l { color: #93A1A1 } /* Literal */
.highlight .n { color: #93A1A1 } /* Name */
.highlight .o { color: #859900 } /* Operator */
.highlight .x { color: #CB4B16 } /* Other */
.highlight .p { color: #93A1A1 } /* Punctuation */