Skip to content

Instantly share code, notes, and snippets.

@scriptingstudio
Last active May 18, 2025 09:11
Show Gist options
  • Select an option

  • Save scriptingstudio/4cf8ab1b671ed81424907b8fd32bccf0 to your computer and use it in GitHub Desktop.

Select an option

Save scriptingstudio/4cf8ab1b671ed81424907b8fd32bccf0 to your computer and use it in GitHub Desktop.
Test leap year in one line
# But [datetime]::IsLeapYear is faster anyway
function Test-IsLeap ([uint32]$year) {
(($year * 1073750999) -band 3221352463) -le 126976
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment