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
async function guessCountryFromNeighbors() { | |
await session | |
.run(` | |
MATCH (c:Country)-[:IS_NEIGHBOR_OF]-(n:Country) | |
WITH c.name AS country, collect(n.name) AS neighbors | |
RETURN country, neighbors | |
`) | |
.then(res => { | |
const i = Math.round(Math.random() * res.records.length - 1) |
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
async function guessCountryFromCapital() { | |
await session | |
.run(` | |
MATCH p = (:Country)<-[:IS_CAPITAL_OF]-(:City) | |
RETURN apoc.coll.randomItem(collect(p)) AS p | |
`) | |
.then(res => { | |
const p = res.records[0].get('p') | |
const capitalName = p.end.properties.name | |
const countryName = p.start.properties.name |
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
const neo4j = require('neo4j-driver').v1 | |
const readlineSync = require('readline-sync') | |
let driver, session | |
async function main() { | |
driver = neo4j.driver( | |
'bolt://localhost', | |
neo4j.auth.basic('neo4j', 'letmein') | |
) |
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
[ | |
{ | |
"name": "Russia", | |
"population": 144526636, | |
"area": 17098242, | |
"capital": "Moscow", | |
"neighbors": ["Azerbaijan", "Belarus", "Estonia", "Finland", "Georgia", "Kazakhstan", "Latvia", "Lithuania", "Norway", "Poland", "Ukraine"] | |
}, | |
{ | |
"name": "Germany", |
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
LOAD CSV FROM "https://gist.githubusercontent.com/jimmycrequer/44b00d26ed1ec69c24c5107146de56c8/raw/a7ce1c5f4424f79299ceae5f6dc8110a348cf4de/worlds2019-picksbans.csv" AS row | |
MERGE (blue:Team {name: row[0]}) | |
MERGE (red:Team {name: row[1]}) | |
MERGE (bb1:Champion {name: row[2]}) | |
CREATE (blue)-[:BANNED]->(bb1) | |
MERGE (bb2:Champion {name: row[3]}) | |
CREATE (blue)-[:BANNED]->(bb2) | |
MERGE (bb3:Champion {name: row[4]}) | |
CREATE (blue)-[:BANNED]->(bb3) |
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
<template> | |
<div class="wrapper" :class="level"> | |
<slot></slot> | |
<span class="right"><slot name="button"></slot></span> | |
</div> | |
</template> | |
<script> | |
export default { |
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
<alert>Something went wrong.</alert> |
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
<template> | |
<div class="wrapper" :class="level"> | |
<slot></slot> | |
</div> | |
</template> | |
<script> | |
export default { | |
props: { | |
level: { type: String, default: 'error' } |