Get links to gists, Powershell version. Get links to gists of active github user
<#
Get list of public gists from GitHub
Dependencies: Powershell v3+
ConvertTo-Hashtable: see in my gists
2017 Andriy Melnyk https://github.com/TurboBasic
#>
$DEFAULT_API = 'https://api.github.com/gists'
#$DEFAULT_API = 'https://api.github.com/users/USERNAME/gists'
Function Get-Gist( [string]$api = 'https://api.github.com/gists' ) {
(curl $api |
select -expandProperty Content |
ConvertFrom-Json) | Foreach-Object {
$_currentRecord=$_
$_.files | ConvertTo-Hashtable |
Select -expandProperty Values |
Foreach-Object {
[PSCustomObject]@{
id = $_currentRecord.id;
description = $_currentRecord.description;
filename = $_.filename;
url = $_.raw_url
}
}
} | Format-List filename, url, description
}