Giter Club home page Giter Club logo

gistcafe-kotlin's Introduction

Useful utils for gist.cafe Kotlin Apps.

Usage

Simple usage example:

import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import java.net.URL
import net.servicestack.gistcafe.*

data class GithubRepo(
    val name: String,
    val description: String = "",
    val homepage: String = "",
    @SerializedName("language") val lang: String = "",
    val watchers: Int,
    val forks: Int)

fun main(args: Array<String>) {
    val orgName = "Kotlin"

    val json = URL("https://api.github.com/orgs/$orgName/repos").readText()
    val orgRepos = Gson().fromJson<List<GithubRepo>>(json)
        .sortedByDescending { it.watchers }

    println("Top 3 $orgName GitHub Repos:")
    Inspect.printDump(orgRepos.take(3))

    println("\nTop 10 $orgName GitHub Repos:")
    Inspect.printDumpTable(orgRepos.take(10), listOf("name","language","watchers","forks"))

    Inspect.vars(mapOf("orgRepos" to orgRepos))
}

Which outputs:

Top 3 Kotlin GitHub Repos:
[
  {
    name: anko,
    description: Pleasant Android application development,
    homepage: ,
    language: Kotlin,
    watchers: 15892,
    forks: 1281
  },
  {
    name: kotlinx.coroutines,
    description: Library support for Kotlin coroutines ,
    homepage: ,
    language: Kotlin,
    watchers: 8684,
    forks: 1228
  },
  {
    name: kotlin-examples,
    description: Various examples for Kotlin,
    language: Kotlin,
    watchers: 2892,
    forks: 1056
  }
]

Top 10 Kotlin GitHub Repos:
+--------------------------------------------------------+
|          name           | language | watchers | forks  |
|--------------------------------------------------------|
| anko                    | Kotlin   |    15892 |   1281 |
| kotlinx.coroutines      | Kotlin   |     8684 |   1228 |
| kotlin-examples         | Kotlin   |     2892 |   1056 |
| kotlinx.serialization   | Kotlin   |     2697 |    287 |
| kotlin-koans            | Kotlin   |     2559 |   1504 |
| KEEP                    |          |     1953 |    215 |
| dokka                   | Kotlin   |     1839 |    194 |
| coroutines-examples     |          |     1259 |    149 |
| kotlin-fullstack-sample | Kotlin   |     1185 |    165 |
| kotlinx.html            | Kotlin   |     1074 |     97 |
+--------------------------------------------------------+

Features and bugs

Please file feature requests and bugs at the issue tracker.

gistcafe-kotlin's People

Contributors

mythz avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.