Skip to content

Instantly share code, notes, and snippets.

@BinaryMuse
BinaryMuse / colortest
Created April 1, 2011 22:40
perl based color test for your terminal
#!/usr/bin/perl
# by entheon, do whatever the hell you want with this file
print "\n";
print "**************************\n";
print "*XTERM 256Color Test Chart\n";
print "**************************\n";
print "* 16 = black\n";
print "* 255 = white\n";
@AitorATuin
AitorATuin / EightQueens.scala
Created August 26, 2012 10:38
Eight Queens in scala
package org.noisesOfHill.exercises.EightQueens
import scalaz._
import Scalaz._
/**
* User: AitorATuin
* Date: 13/06/12
* Time: 19:56
* Little program to solve the epic problem of the Eight Queens.
@marklister
marklister / BaseN.scala
Last active September 20, 2020 23:40
Scala Hex / Decimal / Binary calculator / DSL
/**
* Scala hex / decimal binary calculator
* (c) Mark Lister 2012
* Licence Apache 2.
*/
class BaseN(b: BigInt, val baseN: Int) extends BigInt(b.underlying) {
def n(x: Int) = new BaseN(b, x)
/**
@williballenthin
williballenthin / Willi_Ballenthin-subscriptions.xml
Created March 15, 2013 14:13
OPML of RSS feeds I follow.
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>xolot1 subscriptions in Google Reader</title>
</head>
<body>
<outline text="Believe the Lie" title="Believe the Lie"
type="rss" xmlUrl="http://www.sygyzy.com/feed/" htmlUrl="http://www.sygyzy.com"/>
<outline text="Life Is Too Short For Bad Code"
title="Life Is Too Short For Bad Code" type="rss"
@YoEight
YoEight / Server.scala
Created July 4, 2013 12:17
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 }
@nkpart
nkpart / Loading errors from SBT into a Vim Quickfix.md
Last active February 12, 2018 18:18
Loading errors from SBT into a Vim Quickfix

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 / 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 {