Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh -e
if [ ! $SBT_VERSION ]; then SBT_VERSION=0.7.4; fi
if [ ! $SBT_DIR ]; then SBT_DIR=$HOME/.sbt; fi
if [ ! $SBT_FILENAME ]; then SBT_FILENAME=sbt-launch-$SBT_VERSION.jar; fi
if [ ! $SBT_LOCATION ]; then SBT_LOCATION=$SBT_DIR/$SBT_FILENAME; fi
SBT_URL="http://simple-build-tool.googlecode.com/files/$SBT_FILENAME"
if [ ! -f $SBT_LOCATION ];
// A simple trait:
trait CascadingActions {
implicit def tToActioneerT[T](t: T) = Actioneer(t)
case class Actioneer[T](tee: T) {
def withAction(action: (T => Unit)): T =
withActions(action)
def withActions(actions: (T => Unit)*): T = {
// dependency: org.apache.httpcomponents %% httpclient % 4.0.1
class SSLTest {
import javax.net.ssl.SSLContext
import org.apache.http.conn.ssl.SSLSocketFactory
val ctx = SSLContext.getInstance("TLS")
ctx.init(null, null, null)
val sf = new SSLSocketFactory(ctx)
mkdir bestappever && cd bestappever
g8 gseitz/android-sbt-project
sbt update
sbt compile
@gseitz
gseitz / giter8.rb
Created November 18, 2010 22:11
Brew your own tasty giter8!
require 'formula'
class Giter8 <Formula
JAR = 'sbt-launch-0.7.4.jar'
url "http://simple-build-tool.googlecode.com/files/#{JAR}"
homepage 'http://github.com/n8han/giter8'
md5 '8903fb141037056a497925f3efdb9edf'
version '0.1.1'
def install
module TicTacToe
( Player
, Position
, Board
, InProgress
, Finished
, GameBoard
, Playable
, Completed
, move
@gseitz
gseitz / REPL session
Created July 1, 2011 05:42
Create 1-line extractors for traits
scala> trait YouCantMatchMe
defined trait YouCantMatchMe
scala> object YesICan extends Traitor[YouCantMatchMe]
defined module YesICan
scala> def uncatchable_?(any: Any) = any match {
| case YesICan(uncatchable) => Some(uncatchable)
| case _ => None
| }
@gseitz
gseitz / oxbow.icls
Last active November 22, 2023 08:54 — forked from oxbowlakes/oxbow.xml
IntelliJ IDEA color scheme for Scala/Java
<scheme name="oxbow" version="142" parent_scheme="Default">
<option name="FONT_SCALE" value="1.0" />
<metaInfo>
<property name="created">2023-11-22T09:52:13</property>
<property name="ide">idea</property>
<property name="ideVersion">2023.2.5.0.0</property>
<property name="modified">2023-11-22T09:52:19</property>
<property name="originalScheme">oxbow</property>
</metaInfo>
<option name="LINE_SPACING" value="1.2" />
@gseitz
gseitz / ImplicitTimerDemo.scala
Created July 13, 2011 07:24 — forked from dcbriccetti/ImplicitTimerDemo.scala
Example of using implicit conversions to avoid creating anonymous inner classes
package sample
import java.util.{TimerTask, Timer}
/**
* Shows Java way of creating an anonymous inner class to supply the code for a TimerTask.
*/
object TimerDemo extends Application {
new Timer().schedule(new TimerTask {
def run() {
val rhs = Apply(lensApply, lensGet :: lensSet :: Nil)
yields the correct
rhs: scalaz.Lens.apply[test.this.Foo, scala.this.Int](((t: test.this.Foo) => 3), ((t: test.this.Foo, m: scala.this.Int) => t.copy(m)))
val appliedLensType = TypeApply(REF(lensClass), REF(ccClazz) :: TypeTree(ccMember.symbol.tpe) :: Nil)
yields
appliedLensType: scalaz.this.Lens[test.this.Foo, scala.this.Int]