Skip to content

Instantly share code, notes, and snippets.

@yrong
yrong / monster-query.adoc
Created February 12, 2017 07:28
A monster-query in cypher

A complex query result projection in cypher

Table of Contents

Introduction

Sometimes it is better to request a complete object-tree from the (graph-)database at once instead sending more than one requests to the database and merging the results in program code.

@yrong
yrong / neo4j_cypher_cheatsheet.md
Created February 26, 2017 07:58 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
package main
import (
"go/ast"
"go/parser"
"go/token"
"strconv"
)
// 实现一个只支持int,只支持加法,函数只有println,只支持一个参数的Go语言子集....
@yrong
yrong / RadixSort.java
Created February 2, 2018 04:23 — forked from yeison/RadixSort.java
Implementation of Radix Sort in Java.
/*
RadixSort.java : Sorts 32-bit integers with O(n*k) runtime performance.
Where k is the max number of digits of the numbers being
sorted.
(i.e. k=10 digits for 32-bit integers.)
Copyright (C) 2013 Yeison Rodriguez ( github.com/yeison )
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@yrong
yrong / btree.hpp
Created February 24, 2018 07:41 — forked from zhenghaoz/btree.hpp
B Tree
#include <memory>
#include <vector>
#include <iostream>
template <unsigned N, typename Key, typename Value>
class BTree
{
template <typename T> using vector = std::vector<T>;
template <typename T> using shared_ptr = std::shared_ptr<T>;
var msgSend;
var counter = 0
setInterval(function(){
msgSend = new Buffer(counter.toString());
ipfs.pubsub.publish(topic, msgSend, (err) => {
if (err) {
throw err
}
// msg was broadcasted
})
@yrong
yrong / epoll.go
Created March 8, 2018 10:04 — forked from tevino/epoll.go
Golang example for using epoll
package main
import (
"fmt"
"net"
"os"
"syscall"
)
const (
@yrong
yrong / golang-nuts.go
Created March 15, 2018 01:38 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@yrong
yrong / crawler.go
Created May 30, 2018 11:11 — forked from avalanche123/crawler.go
A Tour of Go. Exercise: Web Crawler
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
Fetch(url string) (body string, urls []string, err error)
@yrong
yrong / learn.lua
Created June 8, 2018 07:42 — forked from tylerneylon/learn.lua
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------