Skip to content

Instantly share code, notes, and snippets.

View marmiha's full-sized avatar
🐢
Slow but steady

marmiha

🐢
Slow but steady
View GitHub Profile
@marmiha
marmiha / main.go
Created January 15, 2022 20:21
Typesafe Event System - Base Go
import "events"
import "fmt"
func main() {
se1 = &someEventListener{}
se2 = &someEventListener{}
// Register the Listeners.
events.SomeEvent.Register(se1)
events.SomeEvent.Register(se2)
@marmiha
marmiha / twitter_id_date_conversion.py
Last active January 15, 2022 19:07
Twitter ID Date Conversion - Python
from datetime import datetime
from typing import List
# Conversion Function.
def twitter_id_to_timestamp(id: int):
return datetime.fromtimestamp(((id >> 22) + 1288834974657) / 1000).strftime('%m-%d-%Y')
# List Comprehension for reusable code.
def twitter_ids_to_timestamp(ids: List[int]):
return [twitter_id_to_timestamp(id) for id in ids]