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
| #!/usr/bin/env ruby1.8 | |
| class Workaround | |
| def initialize target_pid | |
| @target_pid = target_pid | |
| first_child | |
| end | |
| def first_child |
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 org.neo4j.gis.spatial; | |
| import org.neo4j.gis.spatial.indexprovider.SpatialIndexProvider; | |
| import org.neo4j.graphdb.Node; | |
| import org.neo4j.graphdb.Transaction; | |
| import org.neo4j.graphdb.index.Index; | |
| import org.neo4j.kernel.EmbeddedGraphDatabase; | |
| import java.io.BufferedReader; | |
| import java.io.FileReader; |
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 main.java; | |
| import org.neo4j.gis.spatial.indexprovider.SpatialIndexProvider; | |
| import org.neo4j.graphdb.DynamicRelationshipType; | |
| import org.neo4j.graphdb.Node; | |
| import org.neo4j.graphdb.Transaction; | |
| import org.neo4j.graphdb.index.Index; | |
| import org.neo4j.kernel.EmbeddedGraphDatabase; | |
| import java.io.BufferedReader; |
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
| START team = node:teams('name:"Manchester City"') | |
| MATCH team-[:played_in]-game-[goal:scored_in]-player-[:played]-playerStats-[:for]-team, playerStats-[:in]-game | |
| WHERE goal.minute > 75 | |
| RETURN player.name, game.name, goal.minute, game.home_goals + " - " + game.away_goals AS score, game.friendly_date | |
| ORDER BY game.date, goal.minute | |
| +--------------------------------------------------------------------------------------------------------------------+ | |
| | player.name | game.name | goal.minute | score | game.friendly_date | | |
| +--------------------------------------------------------------------------------------------------------------------+ |
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
| // Initial products | |
| CREATE (dress1 { name: "Halter Dress", colour: "Blue"})-[:BRAND]-(frenchConnection { name: "French Connection" }) | |
| CREATE (dress2 { name: "Another Dress", colour: "Yellow"})-[:BRAND]-(frenchConnection) | |
| CREATE (dress3 { name: "Different Dress", colour: "Blue"})-[:BRAND]-(frenchConnection) | |
| RETURN dress1, dress2, dress3 | |
| // Query to find the blue French Connection products | |
| START brand = node:node_auto_index(name="French Connection") | |
| MATCH brand<-[:BRAND]-product | |
| WHERE product.colour = "Blue" |
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
| @Test | |
| public void testEpic() { | |
| Map<String, String> config = SpatialIndexProvider.SIMPLE_POINT_CONFIG; | |
| IndexManager indexMan = db.index(); | |
| Index<Node> index = indexMan.forNodes("geom", config); | |
| Transaction tx = db.beginTx(); | |
| Node n1 = db.createNode(); | |
| n1.setProperty("lat", 60.1); | |
| n1.setProperty("lon", 15.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
| $ ifconfig -u | |
| lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 | |
| options=3<RXCSUM,TXCSUM> | |
| inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 | |
| inet 127.0.0.1 netmask 0xff000000 | |
| inet6 ::1 prefixlen 128 | |
| en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 | |
| ... | |
| status: active | |
| p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304 |
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
| @Test | |
| public void jerseyClientExample() { | |
| Foo foo = new Foo(Client.create()); | |
| // some code here to fake the call to google to make it return 200 | |
| String result = foo.doSomething(); | |
| assertEquals("win", result); | |
| } |
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 com.sun.jersey.api.client.Client; | |
| import com.sun.jersey.api.client.ClientResponse; | |
| import org.junit.AfterClass; | |
| import org.junit.Before; | |
| import org.junit.BeforeClass; | |
| import org.junit.Test; | |
| import static com.thoughtworks.webstub.StubServerFacade.newServer; | |
| import static com.thoughtworks.webstub.dsl.builders.ResponseBuilder.response; | |
| import static org.junit.Assert.assertEquals; |
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 com.sun.jersey.api.client.Client; | |
| import com.sun.jersey.api.client.ClientHandlerException; | |
| import com.sun.jersey.api.client.ClientRequest; | |
| import com.sun.jersey.api.client.ClientResponse; | |
| import org.junit.Test; | |
| import static org.junit.Assert.assertEquals; | |
| public class RandomTest { | |
| @Test |