Skip to content

Instantly share code, notes, and snippets.

View systay's full-sized avatar

Andrés Taylor systay

View GitHub Profile
class Projection(source: Pipe, transformers: List[(Map[String, Any]) => (Map[String, Any])]) extends Traversable[Map[String, Any]] {
def foreach[U](f: (Map[String, Any]) => U) {
source.foreach((m) => {
transformers.map((transformer) => transformer.apply(m)).reduceLeft(_ ++ _)
})
}
}
@systay
systay / gist:984483
Created May 21, 2011 12:33
Failing test
package org.neo4j.lab.cypher
import commands.Query
import util.parsing.combinator.JavaTokenParsers
import org.junit.Assert._
import org.junit.Test
class ParserTest {
@Test def lowerCaseWorks() {
val parser = new TestParser
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.authentication.AuthenticationManagerFactoryBean] while setting bean property 'parent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.dao.DaoAuthenticati
import org.junit.Test
import util.parsing.combinator.JavaTokenParsers
class ParserTest extends JavaTokenParsers {
@Test def aorb() {
val json = """{ "address book": John }"""
val r = parse(json)
println(r)
}
def term: Parser[Expression] = factor ~ rep("*" ~ factor | "/" ~ factor) ^^ {
case head ~ rest => {
var result = head
rest.foreach {
case "*" ~ f => result = Multiply(result,f)
case "/" ~ f => result = Divide(result,f)
}
result
}
ata@iMac-3$ (git::master) mvn -version
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=2048m; support was removed in 8.0
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /usr/local/Cellar/maven/3.0.5/libexec
Java version: 1.8.0-ea, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
~/dev/neo/cqsgraph
ata@iMac-3$ (git::master) mvn clean package
= Fractal graphs
:author: Andrés Taylor
:twitter: @andres_taylor
//setup
//hide
[source,cypher]
----
CREATE ()
@systay
systay / gist:7718178
Last active December 29, 2015 19:38
Description of the three flavours of MERGE
= Merge Examples =
:neo4j-version: 2.0.0-RC1
:author: Andrés Taylor
:twitter: @andres_taylor
:tags: domain:example
//setup
[source,cypher]
----
@Test def test_rewrite() {
trait Exp
case class Add(a: Exp, b: Exp) extends Exp
case class Sub(a: Exp, b: Exp) extends Exp
case class Var(name: String) extends Exp
case class Num(x: Int) extends Exp
val add = Add(Add(Num(1), Num(2)), Num(3))
def rewrite[T <: Exp with Product](ast: Exp with Product)(rewriter: PartialFunction[Exp, Exp]): Exp = {

The "Self-Descriptive" Neo4j Graph Database:

Embedded Metamodel Subgraphs in the FactMiners Social-Game Ecosystem - Part 1 of 4

Author: Jim Salmons, Project Director - The Softalk Apple Project and the FactMiners Ecosystem