Skip to content

Instantly share code, notes, and snippets.

import sys
import requests
from arango import create
from bs4 import BeautifulSoup
HEADERS = {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5)",
from py2neo import neo4j, node
graph_db = neo4j.GraphDatabaseService(
"http://localhost:7474/db/data/")
alice, bob, carol = node(name="Alice"), \
node(name="Bob"), \
node(name="Carol")
abc = neo4j.Path(
alice, "KNOWS", bob, "KNOWS", carol)
from arango import create
from arango.aql import F, V
def dataset():
"""
Basic dataset
"""
a.database.create()
a.users.create()
// service to display *bootstrap modal* popups
// - `display` method return **promise** which
// contain `resolve` or `cancel` handlers (eq buttons)
common.service('confirmService', ["$q", function($q) {
var that = this;
var deferred = null;
// default state for the modal
this.state = {
message: null,
FILES := $(shell find . | grep '\.coffee$$')
TARGETS := $(patsubst %.coffee, %.js, $(FILES))
cleanup:
@echo $(FILES) to cleanup
@echo perl -i.bak -ne 'print if /\S/' $(FILES)
build: $(TARGETS)
%.js: %.coffee
(function (g) {
var VERSION = "0.1.1";
var PREFIX = "___scope_cleaner__";
// check is some variable is array or not
var isArray = function (obj) {
return obj.constructor === Array;
};
// wrapper on Array.indexOf for old browser
@mklymyshyn
mklymyshyn / arango_connect_custom_client.py
Created March 8, 2013 19:40
Create custom connection client for ArangoDB
from arango import create
from arango.clients.urllib2client import Urllib2Client
# create connection to database
voca = create(client=Urllib2Client)
# ...
@mklymyshyn
mklymyshyn / couchdb-views.py
Last active January 16, 2018 01:49
Script to dump or restore CouchDB Design Documents
#!/usr/bin/env python
import argparse
import json
import sys
import StringIO
import couchdb
var n = 1000, cn = "testdocs_js";
db._drop(cn); db._create(cn); var c = db._collection(cn);
var t = new Date(); for (var i = 0; i < n; ++i) { c.save({ "value" : "test_" + i }); }; var e = new Date();
e.getMilliseconds() - t.getMilliseconds();
import sys
import time
from datetime import datetime
from arango import create
from arango.document import Document
from arango.clients import Client
try: