Skip to content

Instantly share code, notes, and snippets.

Wondering why Github added statuses instead of something useful

Ethan Eldridge EdgeCaseBerg

Wondering why Github added statuses instead of something useful
View GitHub Profile
EdgeCaseBerg / WSClientBackend.scala
Last active Oct 16, 2018
WSClient powered backend for sttp.
View WSClientBackend.scala
package module
/* Don't import ._ because there's naming conflicts between sttp and ws for request bodies and whatnot */
import ws.{ WSClient, WSClientConfig, WSRequest, WSResponse }
import play.api.libs.iteratee.Enumerator
import com.softwaremill.sttp._
import com.softwaremill.sttp.internal.SttpFile
import com.softwaremill.sttp.monadSyntax._
EdgeCaseBerg / makeZip.scala
Last active Jul 2, 2018
How to make a zip file in scala (Java 8)
View makeZip.scala
import java.nio.file.{Files, Paths, Path, FileVisitResult}
import java.nio.file.attribute.BasicFileAttributes
import java.nio.file.SimpleFileVisitor
def autoClosing[C <: Closeable, T](closeable: C)(c: C => T) = {
try {
} finally {
EdgeCaseBerg / caseInsensitive.sense
Last active May 11, 2018
Case Insensitive ElasticSearch Regular expressions
View caseInsensitive.sense
# Delete any old test index
DELETE example_copy
# Create index with appropriate mappings/settings
# Note that the pattern is meant to not match anything so that the entire field is taken as the "token"
PUT example_copy
"settings": {
"analysis": {
EdgeCaseBerg / VimeoClient.scala
Last active Apr 9, 2018
How to use Vimeo API from Scala
View VimeoClient.scala
import com.vimeo.networking._
import com.vimeo.networking.model._
import com.vimeo.networking.model.error.VimeoError;
import com.vimeo.networking.callbacks._
import scala.concurrent.{Future, Promise}
import scala.reflect.ClassTag
import scala.reflect._
import okhttp3.CacheControl
EdgeCaseBerg / how to
Created Dec 19, 2017
How to fix reactive mongo playframework dependency issue when (trying) using 12.6
View how to

Getting this?

java.lang.NoSuchMethodError: play.api.libs.iteratee.Execution$Implicits$.trampoline()Lscala/concurrent/ExecutionContext;

Is your build.sbt including a dependency like this?

"org.reactivemongo" %% "play2-reactivemongo" % "0.12.6-play24"
View CustomShellPrompt.scala
import sbt._
import Keys._
// This lifted from
object CustomShellPrompt {
val Branch = """refs/heads/(.*)\s""".r
def gitBranchOrSha =
(Process("git symbolic-ref HEAD") #|| Process("git rev-parse --short HEAD")).!! match {
EdgeCaseBerg / how-to-do-without-tuple-horror.scala
Last active Jun 27, 2017
Over 22 fields in play-json case class. How to deal.
View how-to-do-without-tuple-horror.scala
import play.api.libs.json._
import play.api.libs.functional.syntax._
case class AToM(
a: Int,
b: Int,
c: Int,
d: Int,
e: Int,
f: Int,
View todogss.scala
import com.typesafe.config.ConfigFactory
val c = ConfigFactory.load().getConfig("gs")
import com.mcl.recipesearch.service._
val gsConf = GroceryServerConf(true, new"endpoint")), c.getString("clientId"), c.getString("clientApiKey"))
EdgeCaseBerg / removeAllEmptyChildren.scala
Created Feb 22, 2017
How to remove empty text from HTML with Jsoup + Scala
View removeAllEmptyChildren.scala
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import scala.collection.JavaConverters._
def removeAllEmptyChildren(doc: Document): = {
val allElements = doc.body().getAllElements()
allElements.asScala.foreach { element =>
if(!element.hasText) {