Skip to content

Instantly share code, notes, and snippets.

View MarneeDear's full-sized avatar
📻
You can't stop the signal.

Marnee Dearman (KG7SIO) MarneeDear

📻
You can't stop the signal.
View GitHub Profile

A small social networking website

This database is a small example of a networking site where users can watch movies, subscribe to TV shows and comment and rate any of the previous media. Users may follow or block other users, just like any other networking website nowadays.

  • Purpose:

The theme was chosen because of the success these type of webs have all over the world, and because in general their structure can easily and naturally be displayed as a graph with very different types of relationships and very connected data. So, in a nutshell,

@MarneeDear
MarneeDear / gist:7b7f87dda8019f1d433f
Created March 25, 2015 22:23
DECORATOR Validate activate user json
__author__ = 'marnee'
import functools
from validators import validate_user_schema
def validate_json(func):
def _decorator(json_obj, *args, **kwargs):
# validate json
if validate_user_schema.validate_activate_user(json_obj):
return func(json_obj)
@MarneeDear
MarneeDear / gist:c8d381364ec4d90c90c5
Created March 25, 2015 22:48
PARAMETERIZED DECORATOR validate json
__author__ = 'marnee'
import functools
from validators import validate_user_schema
def validate_json(object_type):
def _check_type(func):
def _validate(json_obj, *args, **kwargs):
# validate json
@MarneeDear
MarneeDear / gist:a158774079acd9ac12d6
Created April 26, 2015 23:46
Find out what other users are interested in
Find out what other users are interested in
match (u:USER {name:'Marnee'})-[ri:INTERESTED_IN]-(i:INTEREST {name:'Amateur Radio'})<-[r2:INTERESTED_IN]-(u2:USER)-[r3:INTERESTED_IN]->(i2:INTEREST)
return u, i, u2, i2
return only those that the user is not already interested in
match (u:USER {name:'Marnee'})-[ri:INTERESTED_IN]-(i:INTEREST {name:'Amateur Radio'})<-[r2:INTERESTED_IN]-(u2:USER)-[r3:INTERESTED_IN]->(i2:INTEREST)
where not (u)-[:INTERESTED_IN]->(i2)
return i2
@MarneeDear
MarneeDear / gist:5a9ff0c9185f1dbfa9f7
Last active August 29, 2015 14:20
Find CQs for a date
Find CQs for a date
match (d:Day {day:1})<-[on:ON]-(cq:CQ)<-[s:SENT]-(u:USER)
return d, on, cq, s, u
Get the full calendar graph
match (calendar)-[:YEAR]->(y)-[:MONTH]->(m)-[:DAY]->(d:Day {day:1})<-[on:ON]-(cq:CQ)<-[s:SENT]-(u:USER)
return u, s, cq, on, d, m, y, calendar
@MarneeDear
MarneeDear / py2neo_nodes_rels.py
Last active February 1, 2018 16:59
py2neo v3 create nodes and relationships
from py2neo import Node, Graph, Relationship, PropertyDict
from db.types import GraphLabel, GraphRelationship
graph_url = 'http://localhost:7474/db/data/'
graph_db = Graph(graph_url)
# delete everything
graph_db.delete_all()
@MarneeDear
MarneeDear / graph_gist_template.adoc
Created January 27, 2017 05:49 — forked from jexp/graph_gist_template.adoc
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

REPLACEME: TITLE OF YOUR GRAPHGIST

Introduction

Data Science Meetup: The Github Graph

@MarneeDear
MarneeDear / Event-stream based GraphQL subscriptions.md
Created June 15, 2017 21:20 — forked from OlegIlyenko/Event-stream based GraphQL subscriptions.md
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

//In my MVC apps I put this in the Startup.Auth file
//Inside
//public void ConfigureAuth(IAppBuilder app)
var edsClient =
new DirectoryServices.EdsClient(appSettings["Eds.Server.Url"], appSettings["Eds.Username"],
appSettings["Eds.Password"]) as Interfaces.IEdsClient;
var casOptions = new CasAuthenticationOptions
{