Skip to content

Instantly share code, notes, and snippets.

View eed3si9n's full-sized avatar

eugene yokota eed3si9n

View GitHub Profile
@eed3si9n
eed3si9n / Main.scala
Last active September 9, 2021 16:30 — forked from xuwei-k/Main.scala
object Main {
def head[A](list: List[A]): A = list.head
def x1: List[Int] | List[String] = List(3)
// this conversion is ok. the opposite doesn't work.
def x2: List[Int | String] = x1
def x3 = head(x1)
@eed3si9n
eed3si9n / sbt-plugin-ranking-2017-08-05.md
Last active June 8, 2018 09:15 — forked from xuwei-k/sbt-plugin-ranking-2014-02-25
List of sbt plugins sorted by GitHub stars. This was generated using https://gist.github.com/eed3si9n/ea4ceef0c5e5c07d6e62c87bea029f88, then augmented by hand.
@eed3si9n
eed3si9n / Main.scala
Last active October 5, 2024 07:43 — forked from xuwei-k/Build.scala
sbt plugin star ranking (using Gigahorse)
package sbt_plugin_ranking
import gigahorse._, support.okhttp.Gigahorse
import gigahorse.github.Github
import scala.concurrent._, duration._
import ExecutionContext.Implicits._
object Main extends App {
val repo = """https:\/\/github.com\/([a-zA-Z0-9_\-]+)\/([a-zA-Z0-9_\-]+)""".r
val url = "https://www.scala-sbt.org/1.x/docs/Community-Plugins.html"
<div style="color:rgb(0,0,0);font-size:medium;font-family:'Helvetica Neue',Arial,sans-serif">
<div style="font-size:13.6px;font-weight:bold;border-bottom-width:2px;border-bottom-style:solid;border-bottom-color:rgb(44,185,219);padding-bottom:3px;width:188px;white-space:nowrap">
<a href="http://event.scaladays.org/scaladays-sanfran-2015" style="text-decoration:none;color:rgb(44,185,217)" target="_blank">JOIN US. REGISTER TODAY!</a>
</div>
<div style="font-size:38px;overflow:hidden">
<div style="width:97px;float:left;white-space:nowrap">
<a href="http://event.scaladays.org/scaladays-sanfran-2015" style="text-decoration:none;color:rgb(44,185,217);font-weight:200" target="_blank"><span class="il">Scala</span></a>
</div>
<div style="font-weight:bold;white-space:nowrap">
Welcome to Scala version 2.11.0-20130329-215811-f2121a31ef (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_43).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scalaz._, Scalaz._
import scalaz._
import Scalaz._
scala> :k Monad
Monad's kind is (* -> *) -> *
@eed3si9n
eed3si9n / Macros.scala
Last active December 13, 2015 23:29 — forked from xuwei-k/Macros.scala
import scala.reflect.macros.Context
import scala.util.matching.Regex
import java.util.regex.PatternSyntaxException
object Macros {
implicit class RegexContext(val c: String) {
def regex(): Regex = macro regexImpl
}
def regexImpl(c: Context)(): c.Expr[Regex] = {
object Test {
def main(args: Array[String]): Unit = {
abstract class Transformer {
def transform(tree: Transformable): Transformable = tree match {
case Class(name, body) => Class(transformName(name), body map {transform(_).asInstanceOf[Statement]})
case VariableWrite(id, value) => VariableWrite(transformName(id), transform(value).asInstanceOf[Expression])
case Return(expr) => Return(transform(expr).asInstanceOf[Expression])
case VariableAccess(id) => VariableAccess(transformName(id))
case Value(value) => Value(transformValue(value))
@eed3si9n
eed3si9n / go.scala
Created February 14, 2012 20:11 — forked from afternoon/go.xsd
XML Schema for Go Feeds API
// Generated by <a href="http://scalaxb.org/">scalaxb</a>.
package go
case class Pipelines(link: go.Link,
pipeline: go.Pipeline)
case class Job(jobsequence1: Option[go.JobSequence1] = None,
href: Option[java.net.URI] = None,
@eed3si9n
eed3si9n / Main.scala
Created February 14, 2012 09:47 — forked from xuwei-k/Main.scala
generate specs2 DataTables using treehugger
object Main extends App {
import treehugger.forest._
import definitions._
import treehuggerDSL._
val n = 10
object sym {
val nList = (1 to n).toList
val TableHeader = RootClass.newClass("TableHeader")