Skip to content

Instantly share code, notes, and snippets.

View hedefalk's full-sized avatar

Viktor Hedefalk hedefalk

View GitHub Profile
@hedefalk
hedefalk / test.scala
Created November 4, 2010 12:38
Ett test
package se.apogo.liftcms
package boot
import model._
import net.liftweb.http.LiftRules
import _root_.net.liftweb.mapper.{Schemifier}
object LiftCmsComponent {
var allowEdit : () => Boolean = () => false
@hedefalk
hedefalk / posterous.html
Created November 4, 2010 13:12
posterous theme
<!DOCTYPE html>
<html lang="en" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta charset="utf-8">
<meta name="color:Background" content="#fff">
<meta name="color:Text" content="#424037">
<meta name="color:Post Title" content="#444">
<meta name="color:Lighter Text" content="#999">
<meta name="color:Date" content="#C6C1A5">
@hedefalk
hedefalk / gist:820610
Created February 10, 2011 14:37
Jetty-plugin-definition
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.25</version>
<configuration>
<reload>manual</reload>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
</configuration>
</plugin>
@hedefalk
hedefalk / gist:820620
Created February 10, 2011 14:40
eclipse.ini for Scala
-startup
../../../plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.0.1.R35x_v20090707
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vmargs
-Xdock:icon=../Resources/Eclipse.icns
def shorten(input: String, acronyms: Set[String]) = {
type Shortenee = String
type Acronym = String
val orderByLength = Ordering[Int].on[Shortenee](c => c.length)
def shortest(unvisited: Set[Shortenee], visited: Set[Shortenee]): Shortenee = {
if (unvisited isEmpty)
visited min orderByLength
else {
val next = unvisited head
object Temperature {
def main(args: Array[String]): Unit = {
val display = Display.getDefault
val window = new Shell(display)
window.setMinimumSize(400, 150)
window.pack
window.setLayout(new GridLayout());
new Temperature(window, SWT.NONE)
window.open
while (!window.isDisposed) {
object Temperature {
implicit def unboxText2Double(t: Text) = java.lang.Double.parseDouble(t.getText())
implicit def convertDouble2String(d: Double) = d.toString
var fahrenheit: Text = null
var celsius: Text = null
def main(args: Array[String]): Unit = {
val window = shell("Demo!",
composite(
trait Source[T] {
def emitTo(v: Var[T]): Unit
}
trait Target[T] {
def bind(value: Signal[T]): Unit
}
implicit def textToSource(text: Text): Source[String] = {
new Source[String] {
override def emitTo(channel: Var[String]) {
text.addModifyListener(new ModifyListener() {
override def modifyText(event: ModifyEvent) = {
channel.update(text.getText)
}
})
}
}
val signal = Var[String]("")
new Text(parent, style) emitTo signal