├── version.go ├── Makefile ├── scripts ├── compile.sh ├── upload.sh └── dist.sh ├── ts.go ├── .gitignore ├── loader ├── common.go ├── json.go └── rss.go ├── LICENSE ├── README.md └── commands.go /version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | const Version string = "0.3.3" 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | DEBUG_FLAG = $(if $(DEBUG),-debug) 2 | 3 | upload: 4 | ./scripts/upload.sh 5 | -------------------------------------------------------------------------------- /scripts/compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DIR=$(cd $(dirname ${0})/.. && pwd) 6 | cd ${DIR} 7 | 8 | XC_ARCH=${XC_ARCH:-386 amd64} 9 | XC_OS=${XC_OS:-darwin linux} 10 | 11 | rm -rf pkg/ 12 | gox \ 13 | -os="${XC_OS}" \ 14 | -arch="${XC_ARCH}" \ 15 | -output "pkg/{{.OS}}_{{.Arch}}/{{.Dir}}" 16 | -------------------------------------------------------------------------------- /ts.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/codegangsta/cli" 7 | ) 8 | 9 | func main() { 10 | app := cli.NewApp() 11 | app.Name = "ts" 12 | app.Version = Version 13 | app.Usage = "" 14 | app.Author = "timakin" 15 | app.Email = "timaki.st@gmail.com" 16 | app.Commands = Commands 17 | 18 | app.Run(os.Args) 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | 6 | # Folders 7 | _obj 8 | _test 9 | 10 | # Architecture specific extensions/prefixes 11 | *.[568vq] 12 | [568vq].out 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.test 24 | *.prof 25 | .DS_Store 26 | -------------------------------------------------------------------------------- /loader/common.go: -------------------------------------------------------------------------------- 1 | package loader 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | ) 7 | 8 | func pp(str string) { 9 | fmt.Printf(str) 10 | } 11 | 12 | func ppred(str string) { 13 | fmt.Printf("\033[1;31m" + str + "\033[0m") 14 | } 15 | 16 | func perror(err error) { 17 | if err != nil { 18 | panic(err) 19 | } 20 | } 21 | 22 | func removeBreak(str string) (result string) { 23 | result = strings.Replace(str, "\n", " ", -1) 24 | return result 25 | } 26 | -------------------------------------------------------------------------------- /scripts/upload.sh: -------------------------------------------------------------------------------- 1 | ./scripts/dist.sh 2 | 3 | VERSION=$(grep "const Version " version.go | sed -E 's/.*"(.+)"$/\1/') 4 | BINTRAY_USER="timakin" 5 | BINTRAY_API_KEY="924f2d307fc1f8bc0f5f8fc4e15b242c2a48d0b7" 6 | 7 | for ARCHIVE in ./pkg/dist/*; do 8 | ARCHIVE_NAME=$(basename ${ARCHIVE}) 9 | 10 | echo Uploading: ${ARCHIVE_NAME} 11 | curl \ 12 | -T ${ARCHIVE} \ 13 | -u ${BINTRAY_USER}:${BINTRAY_API_KEY} \ 14 | "https://api.bintray.com/content/timakin/ts/ts/${VERSION}/${ARCHIVE_NAME}" 15 | done 16 | 17 | rm -rf pkg/ 18 | -------------------------------------------------------------------------------- /scripts/dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | DIR=$(cd $(dirname ${0})/.. && pwd) 6 | cd ${DIR} 7 | 8 | VERSION=$(grep "const Version " version.go | sed -E 's/.*"(.+)"$/\1/') 9 | 10 | # Compile 11 | ./scripts/compile.sh 12 | 13 | # Zip all pacakges 14 | mkdir -p ./pkg/dist 15 | 16 | for PLATFORM in $(find ./pkg -mindepth 1 -maxdepth 1 -type d); do 17 | PLATFORM_NAME=$(basename ${PLATFORM}) 18 | ARCHIVE_NAME=ts_${VERSION}_${PLATFORM_NAME} 19 | 20 | if [ $PLATFORM_NAME = "dist" ]; then 21 | continue 22 | fi 23 | 24 | pushd ${PLATFORM} 25 | zip ${DIR}/pkg/dist/${ARCHIVE_NAME}.zip ./* 26 | popd 27 | done 28 | 29 | pushd ./pkg/dist 30 | shasum * > ./${VERSION}_SHASUMS 31 | popd 32 | 33 | chmod 777 ./pkg/dist/* 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 timakin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /loader/json.go: -------------------------------------------------------------------------------- 1 | package loader 2 | 3 | import ( 4 | "encoding/json" 5 | "github.com/jzelinskie/geddit" 6 | "github.com/kyeah/gohunt/gohunt" 7 | "io/ioutil" 8 | "net/http" 9 | ) 10 | 11 | type Feed interface { 12 | Display() 13 | Setter(name string, title []string, url []string) 14 | } 15 | 16 | type JsonData struct { 17 | Title string `json:"title"` 18 | Url string `json:"url"` 19 | } 20 | 21 | type ResultData struct { 22 | Name string 23 | Title []string 24 | Url []string 25 | } 26 | 27 | func (r *ResultData) Display() { 28 | ppred("[" + r.Name + "]\n") 29 | for key, _ := range r.Title { 30 | pp(" - " + r.Title[key] + "\n") 31 | pp(" - " + r.Url[key] + "\n") 32 | } 33 | pp("\n") 34 | } 35 | 36 | func (r *ResultData) Setter(name string, title []string, url []string) { 37 | r.Name = name 38 | r.Title = title 39 | r.Url = url 40 | } 41 | 42 | func getIdsFromUrl(url string) (ids []int) { 43 | resp, err := http.Get(url) 44 | perror(err) 45 | jsonDataFromHttp, err := ioutil.ReadAll(resp.Body) 46 | perror(err) 47 | err = json.Unmarshal([]byte(jsonDataFromHttp), &ids) 48 | perror(err) 49 | return ids 50 | } 51 | 52 | func getJsonDataFromUrl(url string) (jsonRes JsonData) { 53 | resp, err := http.Get(url) 54 | perror(err) 55 | jsonDataFromHttp, err := ioutil.ReadAll(resp.Body) 56 | perror(err) 57 | err = json.Unmarshal([]byte(jsonDataFromHttp), &jsonRes) 58 | perror(err) 59 | return jsonRes 60 | } 61 | 62 | func getRedditSession() (session *geddit.LoginSession) { 63 | session, _ = geddit.NewLoginSession( 64 | "techstk", 65 | "techstack", 66 | "gedditAgent v1", 67 | ) 68 | return session 69 | } 70 | 71 | func GetPHFeed(ph chan ResultData) { 72 | var result ResultData 73 | var PHTitle, PHUrl []string 74 | 75 | client := gohunt.NewUserClient("a0ad779df4746d96d4d87a5a589f786277c4c78699445fc70abdc08d4be77b45") 76 | 77 | posts, err := client.GetPosts() 78 | perror(err) 79 | if len(posts) > 5 { 80 | posts = posts[:5] 81 | } 82 | for _, post := range posts { 83 | PHTitle = append(PHTitle, post.Name+" : "+post.Tagline) 84 | PHUrl = append(PHUrl, post.RedirectUrl) 85 | } 86 | 87 | result.Setter("ProductHunt", PHTitle, PHUrl) 88 | ph <- result 89 | } 90 | 91 | func GetRedditFeed(re chan ResultData) { 92 | var result ResultData 93 | var RETitle, REUrl []string 94 | 95 | session := getRedditSession() 96 | subOpts := geddit.ListingOptions{Limit: 5} 97 | submissions, _ := session.SubredditSubmissions("programming", geddit.TopSubmissions, subOpts) 98 | for _, s := range submissions { 99 | RETitle = append(RETitle, s.Title) 100 | REUrl = append(REUrl, s.URL) 101 | } 102 | 103 | result.Setter("Reddit", RETitle, REUrl) 104 | re <- result 105 | } 106 | -------------------------------------------------------------------------------- /loader/rss.go: -------------------------------------------------------------------------------- 1 | package loader 2 | 3 | import ( 4 | "encoding/xml" 5 | r "github.com/jteeuwen/go-pkg-rss" 6 | "io/ioutil" 7 | "net/http" 8 | "strings" 9 | ) 10 | 11 | type RSS struct { 12 | XMLName xml.Name `xml:"rss"` 13 | Items Items `xml:"channel"` 14 | } 15 | 16 | type RDF struct { 17 | XMLName xml.Name `xml:"RDF"` 18 | Channel *Channel `xml:"channel"` 19 | Item []*Item `xml:"item"` 20 | } 21 | 22 | type Items struct { 23 | XMLName xml.Name `xml:"channel"` 24 | ItemList []Item `xml:"item"` 25 | } 26 | 27 | type Channel struct { 28 | Title string `xml:"title"` 29 | Description string `xml:"description"` 30 | Link string `xml:"link"` 31 | Date string `xml:"date"` 32 | } 33 | 34 | type Item struct { 35 | Title string `xml:"title"` 36 | Link string `xml:"link"` 37 | Description string `xml:"description"` 38 | } 39 | 40 | func getXMLDataFromUrl(url string) (xmlRes RSS) { 41 | resp, err := http.Get(url) 42 | perror(err) 43 | xmlDataFromHttp, err := ioutil.ReadAll(resp.Body) 44 | perror(err) 45 | err = xml.Unmarshal([]byte(xmlDataFromHttp), &xmlRes) 46 | perror(err) 47 | return xmlRes 48 | } 49 | 50 | func getRDFDataFromUrl(url string) (rdfRes RDF) { 51 | resp, err := http.Get(url) 52 | perror(err) 53 | rdfDataFromHttp, err := ioutil.ReadAll(resp.Body) 54 | perror(err) 55 | err = xml.Unmarshal([]byte(rdfDataFromHttp), &rdfRes) 56 | perror(err) 57 | return rdfRes 58 | } 59 | 60 | func GetRssFeed(name string, url string, rss chan ResultData) { 61 | var result ResultData 62 | var RSSTitle, RSSUrl []string 63 | 64 | xml := getXMLDataFromUrl(url) 65 | for _, item := range xml.Items.ItemList[0:5] { 66 | RSSTitle = append(RSSTitle, strings.Replace(item.Title, "\n", "", -1)) 67 | RSSUrl = append(RSSUrl, strings.Replace(item.Link, "\n", "", -1)) 68 | } 69 | result.Setter(name, RSSTitle, RSSUrl) 70 | rss <- result 71 | } 72 | 73 | func GetRdfFeed(name string, url string, rdf chan ResultData) { 74 | var result ResultData 75 | var RDFTitle, RDFUrl []string 76 | 77 | xml := getRDFDataFromUrl(url) 78 | for _, item := range xml.Item[0:5] { 79 | RDFTitle = append(RDFTitle, strings.Replace(item.Title, "\n", "", -1)) 80 | RDFUrl = append(RDFUrl, strings.Replace(item.Link, "\n", "", -1)) 81 | } 82 | result.Setter(name, RDFTitle, RDFUrl) 83 | rdf <- result 84 | } 85 | 86 | func GetRssFeedWithDesc(name string, url string, rss chan ResultData) { 87 | var result ResultData 88 | var RSSTitle, RSSUrl []string 89 | 90 | xml := getXMLDataFromUrl(url) 91 | for _, item := range xml.Items.ItemList[0:5] { 92 | RSSTitle = append(RSSTitle, strings.Replace(item.Title+": "+removeBreak(item.Description), "\n", "", -1)) 93 | RSSUrl = append(RSSUrl, strings.Replace(item.Link, "\n", "", -1)) 94 | } 95 | result.Setter(name, RSSTitle, RSSUrl) 96 | rss <- result 97 | } 98 | 99 | func GetRdfFeedWithDesc(name string, url string, rdf chan ResultData) { 100 | var result ResultData 101 | var RDFTitle, RDFUrl []string 102 | 103 | xml := getRDFDataFromUrl(url) 104 | for _, item := range xml.Item[0:5] { 105 | RDFTitle = append(RDFTitle, strings.Replace(item.Title+": "+removeBreak(item.Description), "\n", "", -1)) 106 | RDFUrl = append(RDFUrl, strings.Replace(item.Link, "\n", "", -1)) 107 | } 108 | result.Setter(name, RDFTitle, RDFUrl) 109 | rdf <- result 110 | } 111 | 112 | func itemHandler(feed *r.Feed, ch *r.Channel, newitems []*r.Item) { 113 | for _, item := range newitems[0:5] { 114 | pp(" - " + item.Title + "\n") 115 | pp(" - " + item.Links[0].Href + "\n") 116 | } 117 | pp("\n") 118 | } 119 | 120 | func itemHandlerWithDescription(feed *r.Feed, ch *r.Channel, newitems []*r.Item) { 121 | for _, item := range newitems[0:5] { 122 | pp(" - " + item.Title + ": " + removeBreak(item.Description) + "\n") 123 | pp(" - " + item.Links[0].Href + "\n") 124 | } 125 | pp("\n") 126 | } 127 | 128 | func GetUnitRssFeed(uri string) { 129 | timeout := 5 130 | feed := r.New(timeout, true, nil, itemHandler) 131 | err := feed.Fetch(uri, nil) 132 | perror(err) 133 | } 134 | 135 | func GetUnitRssFeedWithDesc(uri string) { 136 | timeout := 5 137 | feed := r.New(timeout, true, nil, itemHandlerWithDescription) 138 | err := feed.Fetch(uri, nil) 139 | perror(err) 140 | } 141 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TechStack 2 | ============ 3 | 4 | ## For what? 5 | Fat RSS reader disturbs your effective information gathering.
Subscribe popular resources simply with CLI. 6 | 7 | ## Supported Services 8 | 9 | - ProductHunt 10 | - Reddit - Programming 11 | - HackerNews 12 | - GithubTrends - All languages#Daily 13 | - TechCrunch 14 | - Mashable 15 | - The Next Web 16 | - Designer News 17 | - Forbes - Tech 18 | - RubyDaily 19 | - Echojs 20 | - Andreessen Horowitz(a16z) 21 | 22 | ## Installation 23 | 24 | ```bash 25 | $ go get -u github.com/timakin/ts 26 | ``` 27 | 28 | ## Example 29 | *If you use iTerm2, you can click the links with cmd + click and directly access to the resources :) 30 | 31 | ``` 32 | $ ts pop 33 | .___________. _______ ______ __ __ _______..___________. ___ ______ __ ___ 34 | | || ____| / || | | | / || | / \ / || |/ / 35 | `---| |----`| |__ | ,----'| |__| | | (----``---| |----` / ^ \ | ,----'| ' / 36 | | | | __| | | | __ | \ \ | | / /_\ \ | | | < 37 | | | | |____ | `----.| | | | .----) | | | / _____ \ | `----.| . \ 38 | |__| |_______| \______||__| |__| |_______/ |__| /__/ \__\ \______||__|\__\ 39 | 40 | 41 | [HackerNews] 42 | - Evaluation of C, Go, and Rust in the HPC environment [pdf] 43 | - http://octarineparrot.com/assets/mrfloya-thesis-ba.pdf 44 | - Show HN: Efficiently searching compressed text files 45 | - https://github.com/mattgodbolt/zindex 46 | - Integer Overflow Bug in Boeing 787 Dreamliner 47 | - http://www.engadget.com/2015/05/01/boeing-787-dreamliner-software-bug/ 48 | - Peter Thiel on what works at work 49 | - http://www.washingtonpost.com/blogs/on-leadership/wp/2014/10/10/peter-thiel-on-what-works-at-work/ 50 | - Show HN: 2D PID controller simulation 51 | - http://nikital.github.io/pid/ 52 | 53 | [ProductHunt] 54 | - Amphetamine : Keep your Mac (and optionally its display) awake 55 | - http://www.producthunt.com/r/69fa7c49c4ae33/19793?app_id=1187 56 | - DUFL : A travel valet that ships, cleans & stores business attire 57 | - http://www.producthunt.com/r/37d5d89f5629e4/19782?app_id=1187 58 | - OneLiners.co : Crowdsource your new company's tagline 59 | - http://www.producthunt.com/r/f9c87e4c9ad2cb/19878?app_id=1187 60 | - Sketch Hunt : Product Hunt for Sketch App resources 61 | - http://www.producthunt.com/r/5c495a1ac67b50/19882?app_id=1187 62 | - Kindrd : Discover connections between music, movies, books & places 63 | - http://www.producthunt.com/r/5dbe16f5479f9c/19869?app_id=1187 64 | 65 | [Reddit] 66 | - Visual C++ Team Blog: Bringing Clang to Windows 67 | - http://blogs.msdn.com/b/vcblog/archive/2015/05/01/bringing-clang-to-windows.aspx 68 | - EarthBound’s Copy Protection (Super Nintendo game) 69 | - http://earthboundcentral.com/2011/05/earthbounds-copy-protection/ 70 | - Servo Continues Pushing Forward 71 | - http://blogs.s-osg.org/servo-continues-pushing-forward/ 72 | - Google’s Dart language on Android aims for Java-free, 120 FPS apps 73 | - http://arstechnica.com/gadgets/2015/05/01/googles-dart-language-on-android-aims-for-java-free-120-fps-apps/ 74 | - Porting a NES emulator from Go to Nim 75 | - http://hookrace.net/blog/porting-nes-go-nim/ 76 | 77 | ...etc 78 | ``` 79 | 80 | ## Other Options 81 | 82 | ``` 83 | $ ts hack // Only programming topics 84 | $ ts hn // HackerNews 85 | $ ts github // GithubTrends 86 | $ ts tc // TechCrunch 87 | $ ts a16z // Andreessen Horowitz 88 | $ ts tnw // The Next Web 89 | $ ts ms // Mashable 90 | $ ts dn // Designer News 91 | $ ts forbes // Forbes - Tech 92 | $ ts echojs // Echojs 93 | $ ts rdaily // RubyDaily 94 | ``` 95 | 96 | ## Contribution 97 | 98 | 1. Fork ([https://github.com/timakin/techstack/fork](https://github.com/timakin/techstack/fork)) 99 | 1. Create a feature branch 100 | 1. Commit your changes 101 | 1. Rebase your local changes against the master branch 102 | 1. Run test suite with the `go test ./...` command and confirm that it passes 103 | 1. Run `gofmt -s` 104 | 1. Create a new Pull Request 105 | 106 | ## Author 107 | 108 | [timakin](https://github.com/timakin) 109 | -------------------------------------------------------------------------------- /commands.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "flag" 5 | "fmt" 6 | "github.com/codegangsta/cli" 7 | "github.com/getwe/figlet4go" 8 | "github.com/timakin/ts/loader" 9 | ) 10 | 11 | var Commands = []cli.Command{ 12 | commandAll, 13 | commandHack, 14 | commandPH, 15 | commandTC, 16 | commandRE, 17 | commandHN, 18 | commandGH, 19 | commandMS, 20 | commandTNW, 21 | commandDN, 22 | commandFB, 23 | commandEJ, 24 | commandA16Z, 25 | commandHatena, 26 | } 27 | 28 | var commandAll = cli.Command{ 29 | Name: "pop", 30 | Usage: "", 31 | Description: "Show today's news from major tech news sites, HN, PH, and subreddit of /programming.", 32 | Action: doAll, 33 | } 34 | 35 | var commandHack = cli.Command{ 36 | Name: "hack", 37 | Usage: "", 38 | Description: ` 39 | `, 40 | Action: doHack, 41 | } 42 | 43 | var commandPH = cli.Command{ 44 | Name: "ph", 45 | Usage: "", 46 | Description: ` 47 | `, 48 | Action: doPH, 49 | } 50 | 51 | var commandHN = cli.Command{ 52 | Name: "hn", 53 | Usage: "", 54 | Description: ` 55 | `, 56 | Action: doHN, 57 | } 58 | 59 | var commandGH = cli.Command{ 60 | Name: "github", 61 | Usage: "", 62 | Description: ` 63 | `, 64 | Action: doGH, 65 | } 66 | 67 | var commandRE = cli.Command{ 68 | Name: "reddit", 69 | Usage: "", 70 | Description: ` 71 | `, 72 | Action: doRE, 73 | } 74 | 75 | var commandTC = cli.Command{ 76 | Name: "tc", 77 | Usage: "", 78 | Description: ` 79 | `, 80 | Action: doTC, 81 | } 82 | 83 | var commandMS = cli.Command{ 84 | Name: "ms", 85 | Usage: "", 86 | Description: ` 87 | `, 88 | Action: doMS, 89 | } 90 | 91 | var commandTNW = cli.Command{ 92 | Name: "tnw", 93 | Usage: "", 94 | Description: ` 95 | `, 96 | Action: doTNW, 97 | } 98 | 99 | var commandDN = cli.Command{ 100 | Name: "dn", 101 | Usage: "", 102 | Description: ` 103 | `, 104 | Action: doDN, 105 | } 106 | 107 | var commandFB = cli.Command{ 108 | Name: "forbes", 109 | Usage: "", 110 | Description: ` 111 | `, 112 | Action: doFB, 113 | } 114 | 115 | var commandEJ = cli.Command{ 116 | Name: "echojs", 117 | Usage: "", 118 | Description: ` 119 | `, 120 | Action: doEJ, 121 | } 122 | 123 | var commandA16Z = cli.Command{ 124 | Name: "a16z", 125 | Usage: "", 126 | Description: ` 127 | `, 128 | Action: doA16Z, 129 | } 130 | 131 | var commandHatena = cli.Command{ 132 | Name: "hatena", 133 | Usage: "", 134 | Description: ` 135 | `, 136 | Action: doHatena, 137 | } 138 | 139 | func pp(str string) { 140 | fmt.Printf(str) 141 | } 142 | 143 | func ppred(str string) { 144 | fmt.Printf("\033[1;31m" + str + "\033[0m") 145 | } 146 | 147 | func displayAA() { 148 | flag_str := flag.String("str", "TechStack", "input string") 149 | flag.Parse() 150 | str := *flag_str 151 | ascii := figlet4go.NewAsciiRender() 152 | renderStr, _ := ascii.Render(str) 153 | ppred(renderStr + "\n\n") 154 | } 155 | 156 | func displayUnitRssFeed(name string, uri string) { 157 | ppred("[" + name + "]\n") 158 | loader.GetUnitRssFeed(uri) 159 | } 160 | 161 | func displayUnitRssFeedWithDesc(name string, uri string) { 162 | ppred("[" + name + "]\n") 163 | loader.GetUnitRssFeedWithDesc(uri) 164 | } 165 | 166 | func doAll(c *cli.Context) { 167 | displayAA() 168 | ph := make(chan loader.ResultData) 169 | re := make(chan loader.ResultData) 170 | hn := make(chan loader.ResultData) 171 | gh := make(chan loader.ResultData) 172 | tc := make(chan loader.ResultData) 173 | ms := make(chan loader.ResultData) 174 | tnw := make(chan loader.ResultData) 175 | dn := make(chan loader.ResultData) 176 | fbs := make(chan loader.ResultData) 177 | ejs := make(chan loader.ResultData) 178 | a16z := make(chan loader.ResultData) 179 | go loader.GetPHFeed(ph) 180 | go loader.GetRedditFeed(re) 181 | go loader.GetRssFeed("HackerNews", "https://news.ycombinator.com/rss", hn) 182 | go loader.GetRssFeedWithDesc("Github Trends", "http://github-trends.ryotarai.info/rss/github_trends_all_daily.rss", gh) 183 | go loader.GetRssFeed("TechCrunch", "http://feeds.feedburner.com/TechCrunch/", tc) 184 | go loader.GetRssFeed("Mashable", "http://feeds.mashable.com/Mashable", ms) 185 | go loader.GetRssFeed("The Next Web", "http://feeds2.feedburner.com/thenextweb", tnw) 186 | go loader.GetRssFeed("Designer News", "https://www.designernews.co/?format=rss", dn) 187 | go loader.GetRssFeed("Forbes - Tech", "http://www.forbes.com/technology/feed/", fbs) 188 | go loader.GetRssFeed("EchoJS", "http://www.echojs.com/rss", ejs) 189 | go loader.GetRssFeed("A16Z", "http://a16z.com/feed/", a16z) 190 | phres := <-ph 191 | reres := <-re 192 | hnres := <-hn 193 | ghres := <-gh 194 | tcres := <-tc 195 | msres := <-ms 196 | tnwres := <-tnw 197 | dnres := <-dn 198 | fbsres := <-fbs 199 | ejsres := <-ejs 200 | a16zres := <-a16z 201 | var PHData loader.Feed = &phres 202 | var REData loader.Feed = &reres 203 | var HNData loader.Feed = &hnres 204 | var GHData loader.Feed = &ghres 205 | var TCData loader.Feed = &tcres 206 | var MSData loader.Feed = &msres 207 | var TNWData loader.Feed = &tnwres 208 | var DNData loader.Feed = &dnres 209 | var FBSData loader.Feed = &fbsres 210 | var EJSData loader.Feed = &ejsres 211 | var A16ZData loader.Feed = &a16zres 212 | PHData.Display() 213 | REData.Display() 214 | HNData.Display() 215 | TCData.Display() 216 | GHData.Display() 217 | MSData.Display() 218 | TNWData.Display() 219 | DNData.Display() 220 | FBSData.Display() 221 | EJSData.Display() 222 | A16ZData.Display() 223 | } 224 | 225 | func doHack(c *cli.Context) { 226 | re := make(chan loader.ResultData) 227 | hn := make(chan loader.ResultData) 228 | gh := make(chan loader.ResultData) 229 | ejs := make(chan loader.ResultData) 230 | go loader.GetRedditFeed(re) 231 | go loader.GetRssFeed("HackerNews", "https://news.ycombinator.com/rss", hn) 232 | go loader.GetRssFeedWithDesc("Github Trends", "http://github-trends.ryotarai.info/rss/github_trends_all_daily.rss", gh) 233 | go loader.GetRssFeed("EchoJS", "http://www.echojs.com/rss", ejs) 234 | reres := <-re 235 | hnres := <-hn 236 | ghres := <-gh 237 | ejsres := <-ejs 238 | var REData loader.Feed = &reres 239 | var HNData loader.Feed = &hnres 240 | var GHData loader.Feed = &ghres 241 | var EJSData loader.Feed = &ejsres 242 | REData.Display() 243 | HNData.Display() 244 | GHData.Display() 245 | EJSData.Display() 246 | } 247 | 248 | func doPH(c *cli.Context) { 249 | ph := make(chan loader.ResultData) 250 | go loader.GetPHFeed(ph) 251 | phres := <-ph 252 | var PHData loader.Feed = &phres 253 | PHData.Display() 254 | } 255 | 256 | func doRE(c *cli.Context) { 257 | re := make(chan loader.ResultData) 258 | go loader.GetRedditFeed(re) 259 | reres := <-re 260 | var REData loader.Feed = &reres 261 | REData.Display() 262 | } 263 | 264 | func doHN(c *cli.Context) { 265 | displayUnitRssFeed("HackerNews", "https://news.ycombinator.com/rss") 266 | } 267 | 268 | func doGH(c *cli.Context) { 269 | displayUnitRssFeedWithDesc("Github Trends", "http://github-trends.ryotarai.info/rss/github_trends_all_daily.rss") 270 | } 271 | 272 | func doTC(c *cli.Context) { 273 | displayUnitRssFeed("TechCrunch", "http://feeds.feedburner.com/TechCrunch/") 274 | } 275 | 276 | func doMS(c *cli.Context) { 277 | displayUnitRssFeed("Mashable", "http://feeds.mashable.com/Mashable") 278 | } 279 | 280 | func doTNW(c *cli.Context) { 281 | displayUnitRssFeed("The Next Web", "http://feeds2.feedburner.com/thenextweb") 282 | } 283 | 284 | func doDN(c *cli.Context) { 285 | displayUnitRssFeed("Designer News", "https://www.designernews.co/?format=rss") 286 | } 287 | 288 | func doFB(c *cli.Context) { 289 | displayUnitRssFeed("Forbes - Tech", "http://www.forbes.com/technology/feed/") 290 | } 291 | 292 | func doEJ(c *cli.Context) { 293 | displayUnitRssFeed("EchoJS", "http://www.echojs.com/rss") 294 | } 295 | 296 | func doA16Z(c *cli.Context) { 297 | displayUnitRssFeed("A16Z", "http://a16z.com/feed/") 298 | } 299 | 300 | func doHatena(c *cli.Context) { 301 | displayUnitRssFeed("Hatena", "http://b.hatena.ne.jp/search/tag?q=%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0&users=10&mode=rss") 302 | } 303 | --------------------------------------------------------------------------------