Skip to content

Instantly share code, notes, and snippets.

from flask import Flask, request, redirect
from uuid import uuid4
app = Flask(__name__)
# TODO: persist to disk
user_state = {}
def make_map():
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/about')
def about():
a = 5
CREATE TABLE users (
name TEXT UNIQUE NOT NULL PRIMARY KEY
);
CREATE TABLE branches (
name TEXT UNIQUE NOT NULL,
owner TEXT NOT NULL REFERENCES users(name),
PRIMARY KEY(name, owner)
);
@njdart
njdart / Reactive-page-builder.html
Created July 3, 2019 10:37
Browser Tools Bookmarks
# Provides two divs, one at the top to input content, one below which has its `innerHTML` set to the content of the top.
# This allows easily building simple tools quickly
data:text/html, <html>
<head>
<style>
.halfBox {
width: 100%;
height: 50%;
// this program is a simple implementation of a reverse polish calculator using an array as a simple stack
// see https://en.wikipedia.org/wiki/Reverse_Polish_notation
package main
import (
"fmt"
"reflect"
)
@njdart
njdart / 3hopsOfEdgeType
Last active July 25, 2018 20:48
Arangodb index query explains
I gave up on this query after 5 minutes of waiting
Query string:
FOR v,e,p in 1..3 OUTBOUND "vertices/14773828" edges FILTER p.edges[*].type ALL == "a" RETURN p
Execution plan:
Id NodeType Est. Comment
1 SingletonNode 1 * ROOT
2 TraversalNode 1000000000 - FOR v /* vertex */, p /* paths */ IN 1..3 /* min..maxPathDepth */ OUTBOUND 'vertices/14773828' /* startnode */ edges
5 ReturnNode 1000000000 - RETURN p
{
"focusedMonitorId": 8388610,
"primaryMonitorId": 8388612,
"clientsCount": 2,
"monitors": [
{
"name": "right",
"id": 8388610,
"randrId": 447,
"wired": true,
'use babel';
import MarkdownParser from 'extensible-markdown';
import fs from 'fs';
import bunyan from 'bunyan';
import Os from 'os';
import Path from 'path';
let logger = bunyan.createLogger({
name: 'markings-extensible-markdown-parser',
@Relation Cleveland
@Attribute age REAL
@Attribute sex REAL
@Attribute chestPain REAL
@Attribute RestingBloodPress REAL
@Attribute SerumCholesterol REAL
@Attribute FastingBloodSugar REAL
@Attribute RestingECGResult REAL
@Attribute MaxHeartRate REAL
@njdart
njdart / extractProjects.js
Last active October 26, 2016 21:33
Aber CS Major Projects
(function() {
var projects = [];
var supervisors = [];
var keywords = {};
$('#supervisor').children().eq(4).children().each(function(index, s) {
var supervisorBlock = $(s);
var supervisorInitials = supervisorBlock.find('h3').attr('id');