Skip to content

Instantly share code, notes, and snippets.

Previously, I played with a way of piping output from SBT into a file that would be truncated on each compile session: https://gist.github.com/nkpart/5923908 . After that, I used cfile to load up the errors in that file.

However, as is so often the case, it turns out most of the plumbing is already there in SBT and VIM and a great solution is trivial.

When SBT runs, it logs each tasks' output into target/streams/<task>. We can use the output stream from compile as the input to cfile, without any of that haskell scripting nonsense!

:cfile ./target/streams/compile/compile/\$global/out

The only other part you need is a nice errorformat value. This setting tells vim how to pull errors out of the parameter to cfile. The one from Derek Wyatt's vim-scala project works:

@AitorATuin
AitorATuin / test1.lua
Created August 7, 2016 10:34
luv bug?
require('luv')
@AitorATuin
AitorATuin / Server.scala
Last active January 22, 2016 19:54 — forked from YoEight/Server.scala
Chunk encoded response using Unfiltered, Netty and Scalaz-Stream
package deiko
import java.nio.charset.Charset
import java.util.concurrent.CancellationException
import org.jboss.netty.buffer.ChannelBuffers
import org.jboss.netty.channel.{ Channel, ChannelFuture, ChannelFutureListener }
import org.jboss.netty.handler.codec.http.{ DefaultHttpChunk, HttpChunk }
import scalaz.stream.{ Process, process1, processes }
import scalaz.concurrent.Task
import Process.{ Process1, Sink }
@AitorATuin
AitorATuin / gist:61d9d5c024cf781cbacd
Last active August 29, 2015 14:26 — forked from runarorama/gist:a8fab38e473fafa0921d
Compositional application architecture with reasonably priced monads
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]
@AitorATuin
AitorATuin / AsyncDirective.scala
Created June 1, 2014 13:57
Jetty Async Plans with Directives Support for Unfiltered
import unfiltered.response._
import unfiltered.request._
import unfiltered.filter._
import unfiltered.directives._
import Directive._
import scala.concurrent.Future
import scala.util.Try
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
object AsyncDirective {
@AitorATuin
AitorATuin / CreateNGinxChroot.sh
Last active October 1, 2015 19:25
Little script based on ArchWiki [https://wiki.archlinux.org/index.php/nginx#Installation_in_a_chroot] that aims to create a chroot environment for nginx
#!/bin/sh
function usage() {
echo -e "Little script to create a chroot environment for nginx installations (under archlinux)."
echo -e "\t ATuin"
echo -e "\t GNU GPL 3.0 . No warranties at all. Use at your own risk."
echo -e
echo -e "" echo usage: $0 [directory]
echo -e "\n\t\t --help :: show detailed help on how to setup the chroot environment"
exit 1;
@AitorATuin
AitorATuin / ParamsReplaceTest.scala
Last active December 21, 2015 18:19
ParamsReplacer example
/**
*
* spores / LogiDev - [Fun Functional] / Logikujo.com
*
* com.logikujo.Spore 25/08/13 :: 20:06 :: eof
*
*/
import com.logikujo.Spore._
import scalaz._

Using Yeoman and Jade

Getting started

  • Make sure you have yo installed: npm install -g yo
  • Run: yo webapp
  • Install grunt-contrib-jade: npm install grunt-contrib-jade --save-dev

Customization

@AitorATuin
AitorATuin / gist:5977350
Created July 11, 2013 17:16
generate checksums for blocks of a video stream in reverse order
package com.logikujo.CryptoI
import scala.annotation.tailrec
import Implicits._
import MessageDigest.JSHA256._
import scalaz._
import Scalaz._
import java.io.{FileInputStream => FIStream, BufferedInputStream => BFStream, RandomAccessFile}
import java.nio.file.{Paths, Path}
@AitorATuin
AitorATuin / Birds.scala
Created April 3, 2013 12:58
Walk the line example from 'http://learnyouahaskell.com/a-fistful-of-monads#walk-the-line' in scala. Birds using plain scala BirdZ using scalaz
package com.logikujo.scalazrepl
import scalaz._
import Scalaz._
object BirdsCommon {
type Pole = (Int, Int)
trait Direction
case object Left extends Direction
case object Right extends Direction