Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
c11ae36
feat: `Get-Prime` ( Fixes #2 )
Jul 12, 2026
2aa6135
feat: `PrimeTime.get_ClassName` ( Fixes #7 )
Jul 12, 2026
8652f3a
feat: `PrimeTime.get_TimeSpan` ( Fixes #5 )
Jul 12, 2026
b295975
feat: `PrimeTime.get_CSS` ( Fixes #6 )
Jul 12, 2026
bf9de9a
feat: `PrimeTime.get_ISO` ( Fixes #8 )
Jul 12, 2026
af3ff9e
feat: `PrimeTime.get_@Property` ( Fixes #9 )
Jul 12, 2026
c66557e
feat: `PrimeTime.get_Animation` ( Fixes #10 )
Jul 12, 2026
a895abd
feat: `PrimeTime.get_SVG` ( Fixes #11 )
Jul 12, 2026
8052ca3
feat: `PrimeTime.ToString()` ( Fixes #12 )
Jul 12, 2026
26aeb3b
feat: `PrimeTime` build ( Fixes #13 )
Jul 12, 2026
328a330
feat: `PrimeTime` default display ( Fixes #4 )
Jul 12, 2026
80f328e
feat: `PrimeTime` default display ( Fixes #4 )
Jul 12, 2026
2d2be92
docs: `/Primes/1mb.primes.txt` ( Fixes #15 )
Jul 13, 2026
31f367b
docs: `PrimeTime.get_SVG` ( Fixes #11 )
Jul 13, 2026
cdaaf2f
feat: `Get-PrimeTime` ( Fixes #3 )
Jul 13, 2026
080b517
feat: `PrimeTime` module ( Fixes #1 )
Jul 13, 2026
c444b83
feat: `PrimeTime.css.ps1` ( Fixes #14 )
Jul 13, 2026
49b1ab5
feat: `PrimeTime.svg.ps1` ( Fixes #16 )
Jul 13, 2026
7602587
feat: `PrimeTime` build ( Fixes #13 )
Jul 13, 2026
074c8e3
feat: `PrimeTime` module ( Fixes #1 )
Jul 13, 2026
3fab6a7
feat: `PrimeTime.html.ps1` ( Fixes #17 )
Jul 13, 2026
92be526
feat: `README.md.ps1` ( Fixes #18 )
Jul 13, 2026
ed41034
feat: `README.md.ps1` ( Fixes #18 )
Jul 13, 2026
7d1e504
Updating Static Content
StartAutomating Jul 13, 2026
9268764
feat: `PrimeTimeSquare.svg.ps1` ( Fixes #19 )
Jul 13, 2026
2bda5ff
Updating Static Content
StartAutomating Jul 13, 2026
844a25e
feat: `PrimeTime` module ( Fixes #1, Fixes #13 )
Jul 13, 2026
1e455b3
Updating Static Content
StartAutomating Jul 13, 2026
7616856
feat: `PrimeTime.get_Timer` ( Fixes #20 )
Jul 13, 2026
cf4bf5f
feat: `PrimeTime.get_Timer` ( Fixes #20 )
Jul 13, 2026
3fac89e
feat: `README.md.ps1` ( Fixes #18 )
Jul 13, 2026
192bd95
Updating Static Content
StartAutomating Jul 13, 2026
59e8bdc
feat: `README.md.ps1` ( Fixes #18 )
Jul 13, 2026
d44348a
Updating Static Content
StartAutomating Jul 13, 2026
b3dadc0
feat: Updating intro, adding logos ( Fixes #1, Fixes #17, Fixes #18 )
Jul 13, 2026
dbb24f6
Updating Static Content
StartAutomating Jul 13, 2026
4c0d631
feat: `PrimeTime.html.ps1` ( Fixes #17 )
Jul 13, 2026
1e7e44d
feat: `PrimeTime.html.ps1` ( Fixes #17 )
Jul 13, 2026
b5eb381
Updating Static Content
StartAutomating Jul 13, 2026
1d9ad78
feat: `/_includes/Palette.ps1` ( Fixes #22 )
Jul 14, 2026
efa8a32
feat: `/_includes/FeatherIcon.ps1` ( Fixes #23 )
Jul 14, 2026
5ef50b0
feat: `PrimeTime` analytics and color ( Fixes #24, Fixes #25 )
Jul 14, 2026
fc15e22
Updating Static Content
StartAutomating Jul 14, 2026
838f50a
feat: `PrimeTime` page ( Fixes #26 )
Jul 14, 2026
92c82a5
feat: `PrimeTime` build ( Fixes #13 )
Jul 14, 2026
b40b48b
feat: `/_includes/CopyCode` ( Fixes #27 )
Jul 14, 2026
26259e8
Updating Static Content
StartAutomating Jul 14, 2026
2169bbe
release: `PrimeTime 0.1` ( Fixes #1 )
Jul 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
549 changes: 549 additions & 0 deletions .github/workflows/BuildPrimetime.yml

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Simple workflow for deploying static content to GitHub Pages
name: deploy

on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]
# or manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, and cancel any in-progress deployments if a new one is triggered
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# GitHub Pages use a single job, named deploy.
deploy:
# By using an environment, we avoid locking
environment:
name: github-pages
# and we can control where it is deployed.
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
# Check out our repository
- name: Checkout
uses: actions/checkout@main
with:
# Using fetch-depth: 0 to ensure we get the full history of the repository
fetch-depth: 0
# Setup GitHub Pages
- name: Setup Pages
uses: actions/configure-pages@main
# To Build Pages in PowerShell, we just call a script
- name: Build Pages
# set the shell to pwsh
shell: pwsh
# and then call any script we would like to build the page.
# By default, this can use the same name as the workflow
# (in this case, just deploy.ps1)
run: . "./deploy.ps1"
# This approach makes it easier to logically organize workflow scripts.
# We will also map the page_url to an environment variable, so our scripts can access it.
env:
page_url: ${{ steps.deployment.outputs.page_url }}
analytics_id: ${{vars.ANALYTICSID}}
- name: Upload artifact
uses: actions/upload-pages-artifact@main
with:
# Upload the contents to the GitHub Pages artifact
path: './'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@main
15 changes: 15 additions & 0 deletions Build/GitHub/Jobs/BuildPrimeTime.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@{
"runs-on" = "ubuntu-latest"
if = '${{ success() }}'
steps = @(
@{
name = 'Check out repository'
uses = 'actions/checkout@main'
},
'RunEZOut',
'PrimeTimeStatic'
)
env = @{
'analyticsid' = '${{vars.ANALYTICSID}}'
}
}
48 changes: 48 additions & 0 deletions Build/GitHub/Steps/PrimeTimeStatic.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Import-Module ./PrimeTime.psd1 -Force -PassThru | Out-Host

$files = @(
# Build markdown first (since HTML may depend on it)
Get-ChildItem -Path *.ps1 -File |
Where-Object Name -match '\.md\.ps1$'

Get-ChildItem -Path *.ps1 -File |
Where-Object Name -match '\.(?>css|html|svg)\.ps1$'
)
$files |
Foreach-Object {
$in = $_
$output = @(. $in.FullName)
$command = Get-Command $in.FullName -CommandType ExternalScript
$file =
New-Item -ItemType File -Value (
$output -join [Environment]::NewLine
) -Force -Path (
$in.FullName -replace '\.ps1$'
)
$file | Out-Host
if ($env:GITHUB_REPOSITORY) {
git add $file.FullName
}
if ($command.Parameters.Variant) {
$output = @(. $in.FullName animated)
$file =
New-Item -ItemType File -Value (
$output -join [Environment]::NewLine
) -Force -Path (
$in.FullName -replace '\.ps1$' -replace
'\.(?<ext>[^\.]+)', '-Animated.${ext}'
)
$file | Out-Host
if ($env:GITHUB_REPOSITORY) {
git add $file.FullName
}
}

}

if (-not $env:GITHUB_REPOSITORY) { return }
git config user.name "StartAutomating"
git config user.email "1043665+StartAutomating@users.noreply.github.com"
git commit -m "Updating Static Content"
git push
$lastExitCode = 0
10 changes: 10 additions & 0 deletions Build/GitHub/Steps/PublishTestResults.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@{
name = 'PublishTestResults'
uses = 'actions/upload-artifact@main'
with = @{
name = 'PesterResults'
path = '**.TestResults.xml'
}
if = '${{always()}}'
}

12 changes: 12 additions & 0 deletions Build/PrimeTime.GitHubWorkflow.PSDevOps.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#requires -Module PSDevOps
Import-BuildStep -SourcePath (
Join-Path $PSScriptRoot 'GitHub'
) -BuildSystem GitHubWorkflow

Push-Location ($PSScriptRoot | Split-Path)

New-GitHubWorkflow -Name "Build PrimeTime" -On Push, PullRequest, Demand -Job TestPowerShellOnLinux,
TagReleaseAndPublish,
BuildPrimeTime -OutputPath .\.github\workflows\BuildPrimetime.yml

Pop-Location
39 changes: 39 additions & 0 deletions Build/PrimeTime.ezout.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#requires -Module EZOut
# Install-Module EZOut or https://github.com/StartAutomating/EZOut
$myFile = $MyInvocation.MyCommand.ScriptBlock.File
$myModuleName = $MyInvocation.MyCommand.Name -replace '\.ezout.ps1$'
$myRoot = $myFile | Split-Path | Split-Path
Push-Location $myRoot
$formatting = @(
# Add your own Write-FormatView here,
# or put them in a Formatting or Views directory
foreach ($potentialDirectory in 'Formatting','Views','Types') {
Join-Path $myRoot $potentialDirectory |
Get-ChildItem -ea ignore |
Import-FormatView -FilePath {$_.Fullname}
}
)

$destinationRoot = $myRoot

if ($formatting) {
$myFormatFilePath = Join-Path $destinationRoot "$myModuleName.format.ps1xml"
# You can also output to multiple paths by passing a hashtable to -OutputPath.
$formatting | Out-FormatData -Module $MyModuleName -OutputPath $myFormatFilePath
}

$types = @(
# Add your own Write-TypeView statements here
# or declare them in the 'Types' directory
Join-Path $myRoot Types |
Get-Item -ea ignore |
Import-TypeView

)

if ($types) {
$myTypesFilePath = Join-Path $destinationRoot "$myModuleName.types.ps1xml"
# You can also output to multiple paths by passing a hashtable to -OutputPath.
$types | Out-TypeData -OutputPath $myTypesFilePath
}
Pop-Location
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## PrimeTime 0.1

* Initial Release of PrimeTime (#1)
* `Get-Prime` gets primes (#2)
* `Get-PrimeTime` gets primes as time intervals (#3)
* `PrimeTime` represents a prime time intervals
* `PrimeTime.Animation` gets a CSS animation (#10)
* `PrimeTime.ClassName` gets the preferred CSS classname for the interval (#7)
* `PrimeTime.CSS` gets the interval as a CSS duration (#6)
* `PrimeTime.ISO` gets the interval as ISO time (#8)
* `PrimeTime.@property` gets a CSS `@property` for the interval (#9)
* `PrimeTime.SVG` gets the interval as a SVG `<animate>` element (#11)
* `PrimeTime.Timer` gets the interval as a Timer (#20)
* `PrimeTime.TimeSpan` gets the interval as a TimeSpan (#5)
* `PrimeTime.ToString()` stringifies an interval (#12)
* `PrimeTime` build (#13)
* `PrimeTime` page (#21, #26)
* `PrimeTime.css.ps1` (#14)
* `PrimeTime.html.ps1` (#17)
* `README.md.ps1` (#18)
* `PrimeTime.svg.ps1` (#16)
* `/_includes/`
* `/_includes/CopyCode.ps1` (#27)
* `/_includes/FeaterIcon.ps1` (#23)
* `/_includes/Palette.ps1` (#22)
39 changes: 39 additions & 0 deletions Commands/Get-Prime.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
filter Get-Prime {
<#
.SYNOPSIS
Gets Primes
.DESCRIPTION
Calculate primes reasonably quickly with the Sieve of Eratosthenes

Pipe in any positive whole number to see if it is prime
.LINK
https://MrPowerShell.com/Tricks/The-Power-Of-Primes/
#>
[Alias('prime')]
param()
if ($args) {
$args | . $MyInvocation.MyCommand
return
}
$in = $_
$in = $in -as [long]
if (-not $in) { return }
if ($in -eq 1) { return $in }
if ($in -lt 1) { return}
if (-not $script:PrimeSieve.Count) {
$script:PrimeSieve = [Collections.Generic.Dictionary[long, bool]]::new()
$script:PrimeSieve[2] = $true
if ($in -gt 2) {
$null = 2..(($in / 2) -as [long[]]) |
. $MyInvocation.MyCommand
}
}

if ($script:PrimeSieve.ContainsKey($in)) { return $in }
foreach ($n in $script:PrimeSieve.Keys) {
if (($n * 2) -gt $in) { break }
if (-not ($in % $n)) { return }
}
$script:PrimeSieve[$in] = $true
$in
}
108 changes: 108 additions & 0 deletions Commands/Get-PrimeTime.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
function Get-PrimeTime {
<#
.SYNOPSIS
Gets PrimeTime intervals
.DESCRIPTION
Primes rarely overlap.

This makes primes more performant and vibrant.

We can animate with prime numbers to make pages feel alive.

We can schedule with prime numbers to avoid traffic jams.
.NOTES
When using prime number intervals, overlaps are rare.

To determine how rare, we can multiply each distinct prime.

Let's show how quickly this adds up:

|Timers|Math|Seconds|Timespan|
|7,11 |`7*11`|77|`00:01:17`|
|7,11,13|`7*11*13`|1001|`00:16:41`|
|7,11,13,17|`7*11*13*17`|17017|`04:43:37`|
|7,11,13,17,19|`7*11*13*17*19`|323323|`3.17:48:43`|
|7,11,13,17,19,23|`7*11*13*17*19*23`|7436429|`86.01:40:29`|


#>
param(
# Gets the Nth prime number
[Parameter(ValueFromPipeline)]
[ValidateRange(1,1mb)]
[Alias('N')]
[int]
$Nth = $(
Get-Random -Min 4 -Max 64
),

# Return the first Nth in the sequence
[Parameter(ValueFromPipelineByPropertyName)]
[int]
$First,

# Return the last Nth in the sequence
[Parameter(ValueFromPipelineByPropertyName)]
[int]
$Last,

# If set, will invalidate the cached list of primes
[switch]
$Force
)

begin {
$rootPath =
if ($myInvocation.MyCommand.Module) {
$myInvocation.MyCommand.Module.Path | Split-path
} else {
$PSScriptRoot | Split-Path
}
if ($Force) {
$script:ListOfPrimes = $null
}
if (-not $script:ListOfPrimes) {
$primesPath = Join-Path $rootPath 'Primes'
$biggestFile =
Get-ChildItem -Path $primesPath -ErrorAction Ignore -Filter '*1mb*.txt' |
Sort-Object Length -Descending |
Select-Object -First 1

$script:ListOfPrimes = ($biggestFile | Get-Content) -as [long[]]
}
}

process {
if ($First) {
foreach ($n in 1..$first) {
[PSCustomObject]@{
PSTypeName = 'PrimeTime'
Nth = $Nth
Prime = $script:ListOfPrimes[$N]
Unit = $unit
}
}
return
}

if ($last) {
foreach ($n in 1..$last) {
$negativeN = $n * -1
[PSCustomObject]@{
PSTypeName = 'PrimeTime'
Nth = $script:ListOfPrimes.Count - $n
Prime = $script:ListOfPrimes[$negativeN]
Unit = $unit
}
}
}

[PSCustomObject]@{
PSTypeName = 'PrimeTime'
Nth = $Nth
Prime = $script:ListOfPrimes[$Nth - 1]
Unit = $unit
}

}
}
Loading
Loading