Skip to content

Instantly share code, notes, and snippets.

@Layoric
Created August 25, 2016 03:15
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 Layoric/d66e3a0a8d6315dbb50ace04d583ec39 to your computer and use it in GitHub Desktop.
Save Layoric/d66e3a0a8d6315dbb50ace04d583ec39 to your computer and use it in GitHub Desktop.
Initializing your Redis connection.
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class GithubRepository
{
public string Name { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public string Homepage { get; set; }
public string Language { get; set; }
public int Watchers { get; set; }
public int Forks { get; set; }
public override string ToString() => Name;
}
var orgName = "ServiceStack";
var orgRepos = "https://api.github.com/orgs/{0}/repos".Fmt(orgName)
.GetJsonFromUrl(httpReq => httpReq.UserAgent = "Gistlyn")
.FromJson<GithubRepository[]>()
.OrderByDescending(x => x.Watchers)
.Take(5)
.ToList();
"Top 5 {0} Github Repositories:".Print(orgName);
orgRepos.PrintDump();
// Save a copy of this *public* Gist by clicking the "Save As" below
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ServiceStack.Text" version="4.0.62" targetFramework="net45" />
<package id="ServiceStack.Client" version="4.0.62" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="4.0.62" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment