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
(defn normalize | |
"Transforms a tabular form to a normalised hierarchical form." | |
([kw values-kw coll] | |
(normalize kw values-kw [] coll)) | |
([kw values-kw promoted-keys coll] | |
(normalize kw values-kw promoted-keys identity coll)) | |
([kw values-kw promoted-keys f coll] | |
(map | |
(fn [[k v]] | |
(merge {kw k |
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
def Y = { le -> ({ f -> f(f) })({ f -> le { x -> f(f)(x) } }) } | |
def factorial = Y { fac -> | |
{ n -> n <= 2 ? n : n * fac(n - 1) } | |
} | |
assert 2432902008176640000 == factorial(20G) |
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
def alphabet = ('A'..'Z')+ ['Æ','Ø','Å'] | |
def combinations = [:] | |
alphabet.each { first -> | |
alphabet.each { second -> | |
alphabet.each { third -> | |
def str = "" + first + second + third | |
def hash = str.hashCode() | |
if (combinations[hash]) { | |
println combinations[hash]+" has same hashcode as "+str+"!!!!!! ("+hash+")" | |
} |
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
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> | |
<link rel="stylesheet" href="ullami.css" type="text/css"> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> | |
<script type="text/javascript" src="ullami.js"></script> | |
</head> | |
<body> |
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
(function ($) { | |
jQuery.noConflict(); | |
var sheepImage = new google.maps.MarkerImage('sau.png', | |
new google.maps.Size(37, 25), // marker size | |
new google.maps.Point(0,0), // origin | |
new google.maps.Point(18, 12)); // anchor is the middle of the image | |
var shape = { | |
coord: [1, 1, 1, 37, 25, 37, 25 , 1], | |
type: 'poly' |
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
// Konverter tekst: Tirsdag, ukenr 49, år 2006 | |
// til dato | |
Date gjettSlakteDato(String tekst, Date compareToDate) { | |
def ukedag = ["Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"] | |
def split = tekst.split(",") | |
String d = ukedag.findIndexOf {it == split[0]} + 1 | |
String ww = split[1][-2..-1] | |
String y = split[2][-1] | |
return convertDateFormat(y+ww+d, compareToDate) | |
} |
NewerOlder