Skip to content

Instantly share code, notes, and snippets.

View jvorhauer's full-sized avatar
🏠
Working from home

Jurjen Vorhauer jvorhauer

🏠
Working from home
View GitHub Profile
@jvorhauer
jvorhauer / MyScalatraServlet.scala
Created October 24, 2016 11:05 — forked from tjdett/MyScalatraServlet.scala
Scala + Apache POI to read uploaded Excel doc
package com.example.app
import org.scalatra._
import servlet.{SizeConstraintExceededException, FileUploadSupport}
import scalate.ScalateSupport
import java.io.ByteArrayInputStream
import org.apache.poi.ss.usermodel.WorkbookFactory
import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.DataFormatter
import org.apache.poi.ss.usermodel.DateUtil
@jvorhauer
jvorhauer / auth.scala
Created December 7, 2016 07:26 — forked from vkostyukov/auth.scala
Simple Auth with Finch
scala> case class Auth(u: String)
defined class Auth
scala> val auth = headerOption("Auth").withDefault("anon").as[Auth].mapOutput { a =>
| if (a.u == "foo") Ok(a) else Unauthorized(new Exception("wrong credentials"))
| }
scala> val e = get("foo" :: auth).map(_.u)
e: io.finch.Endpoint[String] = GET /foo/header(Auth)
@jvorhauer
jvorhauer / GitCommitEmoji.md
Created August 10, 2022 11:30 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji