Skip to content

Instantly share code, notes, and snippets.

@gistlyn
Last active January 18, 2021 05:34
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 gistlyn/166fc83646f5e15f8caa2e80a763305f to your computer and use it in GitHub Desktop.
Save gistlyn/166fc83646f5e15f8caa2e80a763305f to your computer and use it in GitHub Desktop.
Simple VB .NET 5 Console App
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ServiceStack.Common" Version="5.*" />
</ItemGroup>
</Project>
Imports System.Linq
Imports System.Net
Imports ServiceStack
Imports ServiceStack.Text
Module Program
Public Class GithubRepo
Public Property Name As String
Public Property Description As String
Public Property Url As String
Public Property Homepage As String
Public Property Language As String
Public Property Watchers As Integer
Public Property Forks As Integer
End Class
Sub Main(args As String())
Dim orgName As String = "dotnet"
Dim orgRepos = $"https://api.github.com/orgs/{orgName}/repos" _
.GetJsonFromUrl(Sub(httpReq) httpReq.UserAgent = "gist.cafe") _
.FromJson(Of GithubRepo())() _
.OrderByDescending(Function(x) x.Watchers)
Console.WriteLine($"Top 3 '{orgName}' Github Repos:")
orgRepos.Take(3).ToList().PrintDump()
Console.WriteLine($"{vbCrLf}Top 10 {orgName} Github Repos:{vbCrLf}")
orgRepos.Take(10).Select(Function(x) _
New With { x.Name, x.Language, x.Watchers, x.Forks }).PrintDumpTable()
Inspect.vars(New With { orgRepos })
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment