Skip to content

Instantly share code, notes, and snippets.

@fernandoabolafio
fernandoabolafio / notification_work_status.md
Last active August 13, 2018 18:03
This Gist attempts to show the current status of the notification system implementation

Politeia notification system

How it works:

Politeia Users will receive notification through the GUI of relevant events regarding paywall confirmations and admin actions on their proposals. The mapped events so far are:

  • Proposal published
  • Proposal censored
  • Signup Paywal payment confirmed
  • Proposal paywall payment confirmed
@fernandoabolafio
fernandoabolafio / ws_client.html
Created January 16, 2019 19:27
Browser client reference for politeiawww websocket server
<!DOCTYPE html>
<html lang="en">
<head>
<title>Websocket Client</title>
<script type="text/javascript">
window.onload = function () {
var conn;
var msg = document.getElementById("msg");
var log = document.getElementById("log");
var btnConnect = document.getElementById("connect");

Design for politeiawww migration tools

Context:

The politeiawww database is a key-value storage which is used for persisting user's data. The current implementation was designed having the LevelDB as the primary implemenation. Because of the need of scaling WWW, this issue was created and that has been worked on since then.

A feel things have been discussed and defined outside of this issue content:

  • Sensitive data SHALL be encrypted at rest and in flight.
  • Users which were before mapped by email, will now be mapped by their IDs.

New www user database implementation

The goal of this new database implementation is to make the database more robust by adding a cockrochdb implementation and modifying the database interface and the current leveldb implementation as appropriate.

Design

Modify User structure

Here's a first pass.

Normal User

  • Create a Pi account
    • Verify email
    • Pay user registration fee
  • Reset password
  • Change password
  • Update identity
  • Purchase proposal credits

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@fernandoabolafio
fernandoabolafio / Dockerfile
Last active April 29, 2019 14:31
Politeia Dockerfile
FROM ubuntu:latest
LABEL description="politeia quick setup"
LABEL version="1.0"
LABEL maintainer "oxfernando@gmail.com"
RUN apt-get update
RUN apt-get install -y wget git gcc
# Install Go
@fernandoabolafio
fernandoabolafio / useQueryString.js
Last active September 7, 2019 12:11
useQueryString
import { useState, useCallback } from "react";
import { getQueryStringValue, setQueryStringValue } from "./queryString";
function useQueryString(key, initialValue) {
const [value, setValue] = useState(getQueryStringValue(key) || initialValue);
const onSetValue = useCallback(
newValue => {
setValue(newValue);
setQueryStringValue(key, newValue);
},
import React from "react";
import ReactDOM from "react-dom";
import { Tabs, Tab } from "react-bootstrap";
import useQueryString from "./useQueryString";
import "./styles.css";
function App() {
const [value, onSetValue] = useQueryString("water");
return (
import { useEffect, useMemo, useState, useCallback } from "react";
import useQueryString from "./useQueryString";
function useQueryStringWithIndexValue(key, initialIndex, values) {
const computedValues = useMemo(() => values.map(v => v.toLowerCase()), [
values
]);
const [value, onSetValue] = useQueryString(key, values[initialIndex]);
const [index, setIndex] = useState(initialIndex);