Skip to content

Instantly share code, notes, and snippets.


Dino Fancellu fancellu

View GitHub Profile
zhenwenc / DoobieSyntax.scala
Last active March 30, 2020 21:02
Doobie ConnectionIO helpers for use with Quill integration
View DoobieSyntax.scala
import doobie._
import doobie.implicits._
import cats.implicits._
sealed abstract class UnexpectedResultSetSize(msg: String) extends Exception(msg)
final case object UnexpectedOptionalContinuation
extends UnexpectedResultSetSize(s"Expected ResultSet with zero or one row, but more rows were available.")
eduncan911 /
Last active December 15, 2022 16:03
Revert Gist Commits

Revert / Undo a Gist Commit

It was not exactly obvious. Here's how to revert a Gist commit!

Checkout the gist like a normal git repo:

# replace the Gist ID with your own
git clone

Treat it like a normal repo. Edit, force push, etc.

pierrejoubert73 /
Last active April 2, 2023 01:25
How to add a collapsible section in markdown.

How to

  <summary>Click me</summary>
  ### Heading
  1. Foo
  2. Bar
     * Baz
 * Qux
fancellu / .block
Last active March 2, 2023 23:30
Force directed graph for D3.js v4 with labelled edges and arrows
View .block
license: gpl-3.0
height: 600
lihaoyi / trace.scala
Last active December 27, 2015 19:32
Downloading JSON and splatting it into some files in 4 lines of Scala with Ammonite
View trace.scala
haoyi-mbp:Ammonite haoyi$ ~/amm
Welcome to the Ammonite Repl 0.5.2
(Scala 2.11.7 Java 1.8.0_25)
haoyi-Ammonite@ load.ivy("org.scalaj" %% "scalaj-http" % "2.2.0")
haoyi-Ammonite@ import ammonite.ops._, scalaj.http._
import ammonite.ops._, scalaj.http._
haoyi-Ammonite@ Http("").asString
res2: HttpResponse[String] = HttpResponse(
View output.txt$$anon$1(mutingStuff = let's see, otherStuff = List(works, too), stuff = works, moreLazyStuff =$$anon$1$$anon$2(extensionData = This is just some extension data))
Disconnected from the target VM, address: '', transport: 'socket'
"mutingStuff" : "let's see",
"otherStuff" : [ "works, too" ],
"stuff" : "works",
"moreLazyStuff" : {
"extensionData" : "This is just some extension data"
CliffordAnderson / collect.cypher
Last active July 10, 2018 15:59
A Cypher examples to unwind and collect
View collect.cypher
match (a {name:"Daniel"}), (b {name:"Jerry"})
with a,b
match s = shortestPath(a-[]-b)
unwind nodes(s) as n
with collect(n) as m
return head(m)
ScalaWilliam / WSWithoutPlayApp.scala
Last active June 1, 2017 16:16
Running Play WS standalone, without a Play App. Works with Maven builds nicely. The top way to make REST calls in Scala, in my opinion.
View WSWithoutPlayApp.scala
* Play's Scala WS library is very very cool. Provides you with plenty niceties.
* See more:
* Unfortunately it by default requires a Play application context.
* But you do not necessarily always want that.
ScalaWilliam / initialise.scala
Last active August 29, 2015 14:04
Embedded Jetty + Scalatra with Webjars loading (loads META-INF/resources data from the classpath jars). Works without any configuration in Jetty, jetty-maven-plugin, but not so easily in embedded form. Make sure to create websresources/index.html in your src/main/resources/ directory. Examples provided in Scalatra documentation are strange - set…
View initialise.scala
def initialiseApp[T<:LifeCycle](port: Int) = {
val server = new Server(port)
val context = new WebAppContext()
context.setResourceBase(new File(getClass.getResource("/webresources/index.html").getFile).getCanonicalFile.getParentFile.getCanonicalPath)
context.addEventListener(new ScalatraListener)
context.addServlet(classOf[DefaultServlet], "/")
context.setInitParameter(ScalatraListener.LifeCycleKey, classOf[ConfiguredBootstrap].getCanonicalName)
context.setAttribute(WebInfConfiguration.WEBINF_JAR_PATTERN, ".*\\.jar$")
fancellu / TimestampMacro.scala
Created July 22, 2014 09:43
Simple Macro example, allows you to have a string which shows when last compiled. Remember that your main has to be in a different project to the macro (for the moment)
View TimestampMacro.scala
package com.felstar.macros.timestamp
import scala.reflect.macros.blackbox.Context
import scala.language.experimental.macros
object TimestampMacro {
def timestampString: String = macro timestampMacro
def timestampMacro(c: Context): c.Tree = {
import c.universe._