This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- PostgreSQL schema | |
BEGIN; | |
DROP TABLE IF EXISTS wsm; | |
CREATE TABLE wsm | |
( | |
payload jsonb | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |