mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
migration into monorepo complete
This commit is contained in:
31
cmd/cli/cli.go
Normal file
31
cmd/cli/cli.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"github.com/taigrr/gico/gitgraph/term"
|
||||
)
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixMilli())
|
||||
}
|
||||
|
||||
func main() {
|
||||
freq := []int{}
|
||||
for i := 0; i < 7; i++ {
|
||||
freq = append(freq, rand.Int())
|
||||
}
|
||||
fmt.Println("week:")
|
||||
term.GetWeekUnicode(freq)
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
fmt.Println()
|
||||
freq = []int{}
|
||||
for i := 0; i < 365; i++ {
|
||||
freq = append(freq, rand.Int())
|
||||
}
|
||||
fmt.Println("year:")
|
||||
term.GetYearUnicode(freq)
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
git "github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing/object"
|
||||
gterm "github.com/taigrr/gitgraph/term"
|
||||
gterm "github.com/taigrr/gico/gitgraph/term"
|
||||
|
||||
"github.com/taigrr/gico/types"
|
||||
)
|
||||
|
||||
41
cmd/server/svg-server.go
Normal file
41
cmd/server/svg-server.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/taigrr/gico/gitgraph/svg"
|
||||
)
|
||||
|
||||
type DayCount [366]int
|
||||
|
||||
func init() {
|
||||
rand.Seed(time.Now().UnixMilli())
|
||||
}
|
||||
|
||||
func main() {
|
||||
r := mux.NewRouter()
|
||||
r.HandleFunc("/weekly.svg", func(w http.ResponseWriter, r *http.Request) {
|
||||
freq := []int{}
|
||||
for i := 0; i < 7; i++ {
|
||||
freq = append(freq, rand.Int())
|
||||
}
|
||||
w.Header().Add("Content-Type", "text/html")
|
||||
svg := svg.GetWeekSVG(freq)
|
||||
svg.WriteTo(w)
|
||||
})
|
||||
r.HandleFunc("/yearly.svg", func(w http.ResponseWriter, r *http.Request) {
|
||||
freq := []int{}
|
||||
for i := 0; i < 365; i++ {
|
||||
freq = append(freq, rand.Int())
|
||||
}
|
||||
svg := svg.GetYearSVG(freq)
|
||||
w.Header().Add("Content-Type", "text/html")
|
||||
svg.WriteTo(w)
|
||||
})
|
||||
|
||||
http.ListenAndServe(":8080", r)
|
||||
}
|
||||
Reference in New Issue
Block a user