This file contains hidden or 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
def join(list : List[Int]) : String = list match { | |
case List() => "" | |
case List(x) => x.toString | |
case List(x,y) => x + " and " + y | |
case List(x,y,z) => x + ", " + y + ", and " + z | |
case _ => list(0) + ", " + join(list.tail) | |
} |
This file contains hidden or 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
for{ | |
event <- events | |
diff <- event.notifyList | |
val now = new DateTime().plusDays(diff) | |
if (now.getMonthOfYear == event.month && now.getDayOfMonth == event.date) | |
} { | |
hits = hits + 1 | |
Mailer.mail("Reminder: " + event.name + " (" + event.textualDate + ")", | |
"The event '" + event.name + "' occurs " + event.textualDate + ".\n" + |
This file contains hidden or 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
<form method="POST" action="<%= url_for :action => :update %>"> | |
<input type="hidden" name="id" value="<%= @question.object %>"/> | |
<h1 class="groupTitle"><%= @question.q %></h1> | |
<ul> | |
<li> | |
<label for="question[answer]">Eagle</label> | |
<% if @question.answer == "eagle" %> | |
<input type="radio" name="question[answer]" checked="checked" value="eagle"/> | |
<% else %> |
This file contains hidden or 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
1. Installer MacFuse : http://code.google.com/p/macfuse/ | |
2. Installer brew : https://github.com/mxcl/homebrew | |
3. brew install python && brew install pip | |
4. Sette path til brew sin python | |
5. sudo touch /usr/include/osreldate.h | |
#fordi macfuse av en eller annen grunn sier at den er FreeBSD og da forventer fuse-ptyhon at den filen skal finnes | |
6. pip install beautifulsoup && pip install fuse-ptyhon | |
7. git clone <nrkfs> | |
8. ./nrkfs-py <mappe å mounte til> |
This file contains hidden or 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
#!/bin/bash | |
(ssh bjartka@pvv -o PermitLocalCommand=no \ | |
": > ~/.irssi/fnotify ; tail -f ~/.irssi/fnotify " | \ | |
while read heading message; do \ | |
growlnotify -t "${heading}" -m "${message}"; \ | |
done)& | |
This file contains hidden or 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
import annotation.tailrec | |
object Input { | |
def main(args: Array[String]) { | |
println(askInput) | |
} | |
@tailrec | |
private def askInput: String = { | |
lazy val input = try readLine.toInt -1 catch {case _ => -1} |
This file contains hidden or 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
package scalaexamples.quiz.console | |
import scalaexamples.quiz.{Answer, Question, Quiz} | |
import annotation.tailrec | |
class ConsoleGame(quiz: Quiz) { | |
println("Welcome to our faboulus quiz called '" + quiz.title + "'") | |
val answers = quiz.questions.map { | |
question => |
This file contains hidden or 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
~ λ /Users/bjartek/.vim-addons/vim-addon-async/C/vim-addon-async-helper mvim 'VIM' '2' '/Users/bjartek/tmp/vHx9uCJ/7' '/Users/bjartek/tmp/vHx9uCJ/9' '2000' '/bin/bash -i' | |
arg 0 mvim | |
arg 1 --servername | |
arg 2 VIM | |
arg 3 --remote-expr | |
arg 4 async#Receive("2","pid",["22667"]) | |
0 | |
got data | |
sending bytes: bash: no job control in this shell | |
, len 35 |
This file contains hidden or 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
copy paste this into a shell | |
/Users/bjartek/.vim-addons/vim-addon-async/C/vim-addon-async-helper mvim 'VIM' '1' '/Users/bjartek/tmp/vcnZGwR/3' '/Users/bjartek/tmp/vcnZGwR/5' '2000' '/Users/bjartek/.vim-addons/ensime/dist/bin/server.sh '\''/Users/bjartek/tmp/vcnZGwR/2'\'' '\''vim'\''' | |
pid: 33882, bufnr: 4 | |
VIM LOG : sent: [1,"swank:init-project","sexp-string"," ( :project-package \"synonyms\" :use-sbt t )","/Users/bjartek/foo"] | |
server : s shell | |
server : using json protocol | |
server : Project waiting for init... | |
server : Server listening on 55957.. | |
server : Wrote port 55957 to /Users/bjartek/tmp/vcnZGwR/2. |
This file contains hidden or 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
val input = "..*\n...\n*.."; | |
val grid = input.split("\n").map(_.toArray) | |
def bomb(coord: Tuple2[Int,Int]) = grid.lift(coord._1).flatMap(_.lift(coord._2)) match { | |
case Some('.') => 0; | |
case Some('*') => 1; | |
case None => 0 | |
} |