Skip to content

Instantly share code, notes, and snippets.

View Harduim's full-sized avatar

Arthur Harduim Harduim

View GitHub Profile
@Harduim
Harduim / first.py
Last active December 26, 2022 20:11
from typing import Iterable, TypeVar
T = TypeVar("T")
def first(items: Iterable[T], pred: callable) -> T | None:
return next((i for i in items if pred(i)), None)
@Harduim
Harduim / tsql_datetime_10min_rounder_udf.sql
Last active October 4, 2023 20:13
Datetime 10min based rounder for SQL Server
IF OBJECT_ID (N'[ts_round_base]', N'FN') IS NOT NULL
DROP FUNCTION ts_round_base;
GO
CREATE FUNCTION [dbo].[ts_round_base](@ts datetime, @secs_delta int)
RETURNS DATETIME
AS
-- =============================================
-- Author: Arthur Harduim
-- Description: DATETIME rounding function
--