Skip to content

Instantly share code, notes, and snippets.

View sroebuck's full-sized avatar

Stuart Roebuck sroebuck

View GitHub Profile
import scala.util.Random
import scala.language.reflectiveCalls
class Customer(customerId: String, code: String, customerName: String, host: String, val isEnabled: Boolean,
languageCode: String, val isServicesOnly: Boolean, val isEvaluation: Boolean) {
def customerId(): String = customerId
def customerName(): String = customerName
def host(): String = host
def languageCode(): String = languageCode
override def toString = s"Customer($customerId, $code, $customerName, $host, $isEnabled, $languageCode, $isServicesOnly, $isEvaluation)"
@sroebuck
sroebuck / Alternative ICT Strategy.md
Created April 9, 2012 09:01
Alternative ICT Strategy

The Alternative ICT Strategy for the Public Sector in Scotland

By September 2012, the Scottish Government is scheduled to deliver an ICT Strategy for the Public Sector in Scotland[^ictstrategy].  This is a huge opportunity for Scotland to reform the public sector's use of ICT into a service that facilitates the move into a citizen centred, efficient public sector tailored to the varying needs of a diverse and distributed population. Unfortunately, it could also turn out to be a missed opportunity.

Here is my 'alternative' ICT Strategy document.  It is a work in progress so this blog entry will be changing over time.[^gist]  This is what I would like the government ICT strategy document to look like!

Core technology building blocks

To deliver public services in Scotland, the government has adopted some core technologies on which everything can be built.  These technologies are well defined, current, standard and adaptable.

@sroebuck
sroebuck / archiveDesktopFiles.scala
Created January 6, 2012 17:07
Running Scala shell scripts with library dependencies
#!/bin/sh
exec /Users/sroebuck/local/bin/scalas $0 $@
!#
/***
libraryDependencies ++= Seq(
"com.github.scala-incubator.io" %% "scala-io-file" % "0.2.0",
"joda-time" % "joda-time" % "2.0",
"org.joda" % "joda-convert" % "1.1"
)
*/
@sroebuck
sroebuck / build.sbt
Created September 30, 2011 18:01
Combining xsbt-webapp-plugin with coffeescripted-sbt plugin
// For the xsbt-web plugin...
seq(com.github.siasia.WebPlugin.webSettings :_*)
// Add an additional webappResources directory in the target directory...
webappResources <<= (webappResources, target in Compile)((wr, t) => wr +++ t / "webapp_managed" )
// For the CoffeeScripted Sbt plugin...
seq(coffeescript.CoffeeScript.coffeeSettings: _*)
// Use the additional webappResources directory as the targetDirectory for coffee...
import java.lang.Readable
import java.nio.CharBuffer
import java.util.Scanner
val readable = new Readable { def read(x: CharBuffer) = { x.put("12 34".reverse); 5} }
def s = new Scanner(readable)
assert(s.nextInt() == 43)
@sroebuck
sroebuck / atmosphere.md
Created August 27, 2011 23:27
Documentation of Atmosphere

Note that this documentation is a note to self and mostly likely is currently wrong because my code isn't working yet!

Atmosphere

Atmosphere provides consistent client side (JavaScript) and server side (Java) libraries for websocket like support across different web browsers and web servers.

This documentation is written from the perspective of a developer trying to integrate the support into a Scala application which already uses jQuery on the client.

Installing

@sroebuck
sroebuck / gist:1157166
Created August 19, 2011 15:57 — forked from casualjim/gist:913295
'Simple' example of Atmosphere Scala and Scalatra
package com.proinnovate.webfunction
import org.scalatra.ScalatraServlet
import akka.actor.{Scheduler, Actor}
import javax.servlet.http.{HttpServletResponse, HttpServletRequest}
import org.atmosphere.cpr.BroadcastFilter.BroadcastAction
import org.atmosphere.cpr._
import org.atmosphere.util.XSSHtmlFilter
import collection.JavaConversions._
import java.util.concurrent.{LinkedBlockingQueue, TimeUnit}
@sroebuck
sroebuck / ScalaWebFrameworkReview.md
Created January 15, 2011 22:15
Scala Web Framework Review

Scala suited web frameworks

Overview

In general these frameworks provide functionality that covers one or more of the following:

  • Routing: A mechanism for taking HTTP requests and routing them to some code that handles them and returns a response.