with t1 (stat, ts, ndx) as ( select monitor_status, performed_at, row_number() over(order by performed_at) from uptime_checks ) , t2 (stat, startts, endts) as ( select t1.stat, t1.ts, coalesce(t2.ts, now()) from t1 left join t1 t2 on t2.ndx = t1.ndx + 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
with t1 (id, stat, ts, ndx) as ( | |
select monitor_id, monitor_status, performed_at, row_number() over(order by performed_at) | |
from uptime_checks | |
), | |
t2 (id, stat, startts, endts) as ( | |
SELECT t1.id, t1.stat, t1.ts, coalesce(t2.ts, now()) | |
from t1 | |
left join t1 t2 | |
on t2.ndx = t1.ndx + 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
[{"groups":[{"name":"Frequent","bookmarks":[{"name":"Pocket","url":"https://app.getpocket.com/"},{"name":"GitHub","url":"https://github.com/"},{"name":"YouTube","url":"https://www.youtube.com/"}]}]},{"groups":[{"name":"Work","bookmarks":[{"name":"Github - Status Monitor","url":"https://github.com/Violet88github/status-monitor"},{"name":"Asana - Status Monitor","url":"https://app.asana.com/0/1165563750364778/board"},{"name":"Canvas","url":"https://canvas.hu.nl/"},{"name":"Osiris","url":"https://osiris.hu.nl/"}]}]},{"groups":[{"name":"News","bookmarks":[{"name":"NOS","url":"https://nos.nl/"},{"name":"ProductHunt","url":"https://www.producthunt.com/"}]},{"name":"Movies/series","bookmarks":[{"name":"IMDB","url":"https://www.imdb.com/"},{"name":"Snahp.it","url":"https://forum.snahp.it/"},{"name":"1337x","url":"https://www.1337x.tw/"},{"name":"Base64 Decode","url":"https://www.base64decode.org |
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
SELECT t1.status_code, t1.response_time, t1.monitor_status, t1.performed_at FROM uptime_checks AS t1 WHERE performed_at = (SELECT max(t2.performed_at) FROM uptime_checks as t2 WHERE t1.monitor_id = t2.monitor_id); |
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
import { useRef, useEffect } from 'react'; | |
const useInterval = (callback, delay) => { | |
const savedCallback = useRef(); | |
// Remember the latest function. | |
useEffect(() => { | |
savedCallback.current = callback; | |
}, [callback]); |