Skip to content

Instantly share code, notes, and snippets.

@csthompson
csthompson / 0_reuse_code.js
Created October 5, 2013 03:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@csthompson
csthompson / djb2_hash
Created October 5, 2013 03:40
Hashing
unsigned long
hash(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-qtree}
\usepackage{fancybox}
\usetikzlibrary{calc,shapes.multipart,chains,arrows}
\begin{document}
\section{Input}
\begin{tikzpicture}
[list/.style={rectangle split, rectangle split parts=2, draw, rectangle split horizontal}, >=stealth, start chain]
@csthompson
csthompson / new_gist_file
Created October 16, 2013 21:51
Database URL
http://americanart.si.edu/collections/search/artwork/results/index.cfm?rows=10&fq=online_media_type:%22Images%22&q=&page=3&start=20&x=30&y=6
= Create nodes and relationships =
// console
Create a node for the actor Tom Hanks:
[source,cypher]
----
CREATE (n:Actor {name:"Tom Hanks"});
----
@csthompson
csthompson / publisher.go
Last active September 11, 2020 22:57
NATS Publisher
package main
import (
"log"
"time"
nats "github.com/nats-io/nats.go"
)
type Msg struct {
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
func main() {
ast.Inspect(file, func(n ast.Node) bool {
// Find Function Call Statements
funcCall, ok := n.(*ast.CallExpr)
if ok {
fmt.Println(funcCall.Fun)
}
return true
})
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
func main() {
package main
import (
"fmt"
"go/ast"
"go/parser"
"go/token"
)
func main() {