Skip to content

Instantly share code, notes, and snippets.

import xml.{Node, Elem}
class Pluser(lhs : Unit => Seq[Node]) {
def ++(rhs : Unit => Seq[Node]) = (_ : Unit) => lhs() ++ rhs()
}
object Main {
implicit def hotString(s : Seq[Node]) = (_ : Unit) => s
implicit def pluser(lhs : Unit => Seq[Node]) = new Pluser(lhs)
#RUBY
class String
def / other
self + "/" + other
end
end
#SCALA
#!/bin/sh
exec scala -cp /home/glen/src/gitwatch/lib/jgit.jar $0 $@
!#
import java.io.File
import org.spearce.jgit.lib.{Commit => GitCommit, Repository}
val repo = new Repository(new File(args(0)))
val head = repo.mapCommit("HEAD")
def history(c: GitCommit): List[GitCommit] = {
ruby -e '`grep -rn "enabled = false" .`.map{|l|l.chomp.split(":")}.map{|f,l,_|[f,l]+`git blame -t -L#{l.to_i+1},+1 #{f}`.match(/^[^\(]*\((.*) \d+ \+[^\)]*\)(.*)$/).to_a[1..-1]}.sort_by{|_,_,a,_|a}.each{|f,l,a,t|puts "#{a} - \"#{t}\" (#{f}:#{l})"}'
class A {}
class B extends A {}
class Foo<X extends A> {
//fails
void foo(X x, Predicate<X> p) {
if (x instanceof B) {
p.apply((B) x);
}
}
Last login: Thu Oct 15 20:38:40 on console
Glen-Madderns-MacBook-Pro:~ glen$ bash -c '`curl -L babushka.me/up`'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3314 100 3314 0 0 1246 0 0:00:02 0:00:02 --:--:-- 5182
bash: #!/bin/bash: No such file or directory
Glen-Madderns-MacBook-Pro:~ glen$ bash -c "`curl -L babushka.me/up`"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3314 100 3314 0 0 1599 0 0:00:02 0:00:02 --:--:-- 8168
If you follow the tutorial, when you get to http://www.playframework.org/documentation/1.0/guide6
In the section 'A little more difficult now', if you add the following line to the suggested test case, you get a failure:
assertEquals(Arrays.asList(bobPost), Post.findTaggedWith("Red", "Blue"));
assertEquals(Arrays.asList(anotherBobPost), Post.findTaggedWith("Red", "Green"));
It appears the code within Post.findTaggedWith is actually returning a List<Int>
$ /opt/idea/bin/idea.sh
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f6241a3ea9c, pid=22254, tid=140055613524304
#
# Java VM: OpenJDK 64-Bit Server VM (14.0-b08 mixed mode linux-amd64 )
# Distribution: Ubuntu 9.04, package 6b14-1.4.1-0ubuntu12
# Problematic frame:
# V [libjvm.so+0x3d8a9c]
>> @delimeter
=> ","
>> "\"two three\", four".match /(.*)",(.*)/
=> #<MatchData "\"two three\", four" 1:"\"two three" 2:" four">
>> "\"two three\", four".match /(.*)"#{@delimiter}(.*)/
=> #<MatchData "\"two three\", four" 1:"\"two three" 2:", four">
case class Post(username: String, title: String, body: String)
object Main {
import Tags._
def main(args: Array[String]) {
println(render(Post("glen", "opinions", "wack.")))
}
def render(post: Post) = {
html(