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
scala> val Title = """(Mrs?).*""".r | |
Title: scala.util.matching.Regex = (Mrs?).* | |
scala> "Mr. Belvedere" match { | |
| case Title(title) => println("hey there " + title) | |
| case _ => println("who are you?"); | |
| } | |
hey there Mr | |
scala> val TitleName = """(Mrs?)(.*)""".r |
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
/* Stack a red cross on top of a white circle to make a marker for hospital points */ | |
* { | |
mark: symbol(circle), symbol(cross); | |
} | |
:nth-mark(1) { | |
fill: white; | |
stroke: red; | |
} |
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
* { fill: blue, symbol('shape://slash'); } | |
:fill { stroke: red; } |
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
object Combine { | |
def linear[A](xs: Seq[A]): Seq[Seq[A]] = | |
xs match { | |
case Seq() => Seq(Seq()) | |
case Seq(h, t @ _*) => | |
linear(t) flatMap { ts => Seq(ts, h +: ts) } | |
} | |
def binary[A](xs: Seq[A]): Seq[Seq[A]] = | |
xs match { |
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
from django.contrib.gis.geos import GEOSGeometry | |
import json | |
import sys | |
bluemarble = r"""{ | |
"fields": { | |
"fixed": true, | |
"format": null, | |
"group": "background", | |
"layer_params": "{\"args\": [\"bluemarble\", \"http://maps.opengeo.org/geowebcache/service/wms\", {\"layers\": [\"bluemarble\"], \"tiled\": true, \"tilesOrigin\": [-20037508.34, -20037508.34], \"format\": \"image/png\"}, {\"buffer\": 0}], \"type\": \"OpenLayers.Layer.WMS\"}", |
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
[type='store'] { | |
mark: url("http://example.com/storefront.jpeg"); | |
} | |
[type='restaurant'] { | |
mark: url("http://example.com/restaurant.jpeg"); | |
} |
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
* { | |
label: [strtouppercase(TITLE)]; | |
} |
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
* { | |
stroke: black, symbol(circle); | |
stroke-width: 15px; | |
stroke-linejoin: round; | |
stroke-linecap: round; | |
stroke-dasharray: 1 0, 5 35; | |
stroke-dashoffset: 0; | |
z-index: 0, 10; | |
} |
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 rle[A](as: Seq[A]): Seq[(Int, A)] = as match { | |
case Seq() => Seq() | |
case Seq(a, as @ _*) => (1 + as.takeWhile(a ==).length, a) +: rle(as.dropWhile(a ==)) | |
} | |
rle("AAABBCCCDDDDE") map { case (i, c) => i.toString + c } mkString |
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
public class Sample { | |
static class A { | |
private String foo; | |
private Integer bar | |
public A(String foo, Integer bar) { | |
this.foo = foo; | |
this.bar = bar; | |
} | |
} |