Skip to content

Instantly share code, notes, and snippets.

View hazadus's full-sized avatar
💥

Alexander Goldovsky hazadus

💥
View GitHub Profile
@guillaumepiot
guillaumepiot / PYTHON - Convert URL in text to anchor tags (links)
Created January 15, 2013 16:42
PYTHON - Convert URL in text to anchor tags (links)
@ZhouYang1993
ZhouYang1993 / sort_dict.py
Created September 26, 2022 21:09
Sorting a Python Dictionary
cities = {'London': '2', 'Tokyo': '3', 'New York': '1'}
print(sorted(cities.items(),key=lambda d:d[1]))
# [('New York', '1'), ('London', '2'), ('Tokyo', '3')]
@Atinux
Atinux / sse.ts
Last active June 4, 2024 05:47
SSE endpoint example with Nuxt 3
// ~/server/api/sse.ts
export default defineEventHandler(async (event) => {
if (!process.dev) return { disabled: true }
// Enable SSE endpoint
setHeader(event, 'cache-control', 'no-cache')
setHeader(event, 'connection', 'keep-alive')
setHeader(event, 'content-type', 'text/event-stream')
setResponseStatus(event, 200)