Skip to content

Instantly share code, notes, and snippets.

@dfinke
Created June 21, 2014 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dfinke/6c4a7064651e66a4713d to your computer and use it in GitHub Desktop.
Save dfinke/6c4a7064651e66a4713d to your computer and use it in GitHub Desktop.
Download Github Emojis Using PowerShell Workflow
workflow Get-GithubEmojis {
param($TargetPath="c:\temp\emojis")
if(!(Test-Path -Path $TargetPath)) {
$null= New-Item -ItemType Directory -Path $TargetPath
}
$emojis = Invoke-RestMethod -Uri https://api.github.com/emojis
$names = ($emojis | Get-Member -MemberType NoteProperty).name
$records = $names | ForEach {
$target=$emojis.$PSItem
[PSCustomObject]@{
FileName=(Split-Path -Leaf $target) -replace "\?v5", ""
Url=$target
}
}
ForEach -Parallel ($record in $records)
{
try {
Invoke-RestMethod -Uri $record.Url -OutFile (Join-Path -Path $TargetPath -ChildPath $record.FileName)
} catch {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment