Skip to content

Instantly share code, notes, and snippets.

// problem in https://twitter.com/Al_Grigor/status/1357028887209902088
const funcReducer = (state, currentChar) => {
const isNewGroup = currentChar != state.lastChar ? true : false
switch (isNewGroup) {
case true:
state.out = [...state.out, {
[currentChar]: 1
}]
-- PostgreSQL schema
BEGIN;
DROP TABLE IF EXISTS wsm;
CREATE TABLE wsm
(
payload jsonb
);
@agrrd
agrrd / memfile2pg.sql
Last active January 16, 2021 01:38
Kea migrate memfile leases to PostgreSQL
BEGIN;
CREATE OR REPLACE FUNCTION inet2bigint(inet) RETURNS bigint AS
$$
SELECT ($1::inet - '0.0.0.0'::inet)::bigint;
$$ LANGUAGE 'sql';
DROP CAST IF EXISTS (inet AS bigint);