Skip to content

Instantly share code, notes, and snippets.

@brabadu
Last active August 29, 2015 14:13
Show Gist options
  • Save brabadu/7d007f11f4ebd82f98b0 to your computer and use it in GitHub Desktop.
Save brabadu/7d007f11f4ebd82f98b0 to your computer and use it in GitHub Desktop.
Generate a oneline descriptions for github repo with API
(ns example
(:require [clojure.data.json :as json]
[clojure.string :as string]))
(defn descriptions [repos]
(map (fn [html-repo] (let [
api-repo (string/replace html-repo #"github.com" "api.github.com/repos")
json-resp (json/read-str (slurp api-repo)
:key-fn keyword)
name (:name json-resp)
url (:html_url json-resp)
description (:description json-resp)
homepage (:homepage json-resp)
line (format "* [%s](%s) %s %s" name url description homepage)]
line))
repos))
(def myreps [
"https://github.com/MfgLabs/mfglabs-iconset"
"https://github.com/parkerbennett/stackicons"
"https://github.com/samcollins/css-social-buttons"
"https://github.com/Keyamoon/IcoMoon-Free"
"https://github.com/jhogue/PE-Analog-Clock-icon-font"
"https://github.com/erikflowers/weather-icons"
])
(println (string/join "\n" (descriptions myreps)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment