This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'time' | |
require 'logger' | |
require 'rubygems' | |
require 'pingdom-client' | |
require 'active_support/core_ext/numeric/time' # time extensions, e.g., 5.days | |
require 'stashboard' | |
TIME_FORMAT = "%Y-%m-%d %H:%M:%S %Z" # YYYY-MM-DD HH:MM:SS ZZZ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee(var employer: Employer) | |
class Employer(var name: String) | |
object Test { | |
import Properties._ | |
// killer boilerplate of death !!! | |
val name1 = property( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Generator[T] extends Iterable[T] { | |
val buffer = scala.collection.mutable.ArrayBuffer[() => Iterable[T]]() | |
protected def <<(t: => T) { buffer += (() => List(t)) } | |
protected def <<<(t: => Iterable[T]) { buffer += (() => t) } | |
override def iterator = buffer.toStream.flatMap(_.apply).iterator | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*{toc}* | |
---- | |
Basically you can run jetty in two different modes: | |
# Interactively: use s.th. like {{buildr yourproject:run-jetty}} and have the jetty running within this shell, so that you see the output of jetty and your app | |
# In the background: use {{buildr jetty:start}} and {{buildr yourproject:deploy-app}} to start jetty in the background and deploy your app. The build is not blocking in this case and you can use your shell for different things. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'optparse' | |
# Parse arguments | |
OPTIONS = {} | |
op = OptionParser.new do |x| | |
x.banner = 'killjava [-9] [-n] [java_main_class]' | |
x.separator '' | |
x.on("-9", "--KILL", "Send KILL signal instead of TERM") do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Fixed point combinator: The essence of recursion */ | |
def fix[T, R](f: (T => R) => (T => R)): (T => R) = new Function1[T, R] { | |
def apply(t: T): R = f(this)(t) | |
} | |
/** Factorial definition with fixed point */ | |
def factorial(recursive: Long => Long) = (x: Long) => x match { | |
case 1 => 1 | |
case x => x * recursive(x-1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'oauth' | |
require 'oauth/consumer' | |
require 'json' | |
key = 'xxxxxxxx' | |
secret = 'yyyyyyyy' | |
consumer = OAuth::Consumer.new(key, secret, { | |
:site => "http://api.bizographics.com", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interactive example: | |
Welcome to Scala version 2.8.0.Beta1-prerelease (Java HotSpot(TM) Server VM, Java 1.6.0_17). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> :load MapReduce.scala | |
Loading MapReduce.scala... | |
defined class MapReduce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Sample buildfile for akka-sample-chat (akka 0.6). | |
Save as akka-0.6/akka-samples/akka-sample-chat/Buildfile | |
Shell #1: | |
% export AKKA_HOME=... | |
% cd $AKKA_HOME | |
% java -jar dist/akka-0.6.jar | |
Shell #2: |
NewerOlder