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
public static <T> void jsonRoundTripTest(final T instance) throws Exception { | |
final String clazz = instance.getClass().getName(); | |
final String fixtureName = instance.getClass().getSimpleName().toLowerCase(); | |
final String fixture = jsonFixture("fixtures/" + fixtureName + ".json"); | |
assertThat(clazz + " bad json,", | |
asJson(instance), | |
is(fixture)); | |
T deserialized; | |
try { | |
deserialized = fromJson(fixture, (Class<T>)instance.getClass()); |
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
-module(gol). | |
-include_lib("eunit/include/eunit.hrl"). | |
next(World) -> | |
sets:fold(fun(Member, Result) -> | |
Count = sets:size(live_neighbours(Member, World)), | |
case Count of | |
2 -> | |
sets:add_element(Member, Result); | |
_ -> |
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
if(leftImage != null) | |
{ | |
leftImage = leftImage.toLowerCase(); | |
} | |
if(leftImage.equals("null")) | |
{ | |
leftImage = null; | |
} | |
// ... repeated for 5 different string variables |
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
System.err.println(new PriorityQueue<Integer>(Arrays.asList(3, 1, 2))); | |
// Prints: [1, 3, 2] | |
System.err.println(new TreeSet<Integer>(Arrays.asList(3, 1, 2))); | |
// Prints: [1, 2, 3] | |
/* | |
This is due to PriorityQueue's Iterator. From the javadoc: | |
"...Iterator provided in method iterator() is not guaranteed to | |
traverse the elements of the priority queue in any particular order...". |
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 riak { | |
$configbase = "/etc/riaksearch" | |
$riak_dir = "/var/lib/riaksearch" | |
$username = "riak" | |
package { "riak-search": ensure => latest, } | |
user { $username: | |
shell => '/bin/bash', | |
comment => 'Basho Riak', |
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
#set($path=$param0.replace("::", "=")) | |
#set($space=$renderContext.getOriginalContext().getSpaceKey()) | |
#if($space.equals("PRIVATE")) | |
#set($domain="http://your.internal.url") | |
#else | |
#set($domain="http://your.public.url") | |
#end | |
#set($url="${domain}${path}") |
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
-module(a). | |
-export([tgif/0]). | |
-define(MUSIC_ASSOCIATIONS, [{ellnestam, "Love Gun"}, {jockeholm, "Family Affair"}, {mahnve, "My name is (Slim Shady)"}]). | |
tgif() -> tgif(?MUSIC_ASSOCIATIONS). | |
tgif([{Person, Track}|Others]) -> | |
io:format("@~w plays '~s'~n", [Person, Track]), | |
tgif(Others); | |
tgif([]) -> "Hey! It's friday, have a beer!". |
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
# Copy the accept header to a variable | |
set $acceptHeader $http_accept; | |
# Does the request end in xml or json? | |
if ($uri ~ ^(.*)\.(xml|json)$) { | |
# Create a new accept header... | |
set $acceptHeader "application/$2"; | |
# ...and remove the extension from the path | |
rewrite ^(.*)\.(xml|json)$ $1 last; | |
} |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<artifactId>neo4j-spatial</artifactId> | |
<packaging>jar</packaging> | |
<version>0.0.1-SNAPSHOT</version> | |
<dependencies> | |
<dependency> | |
<groupId>org.geotools</groupId> | |
<artifactId>gt-referencing</artifactId> |
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
## | |
## Atlassian Confluence Wiki User Macro | |
## | |
## Example of how to get the space key of the space that this page is being rendered in | |
## ie, not necessarily the same space as the page belongs to | |
## | |
#set($space=$renderContext.getOriginalContext().getSpaceKey()) | |
## This will allow you to do magic based on the space |