this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

misc (#4)

Co-authored-by: Anish Lakhwara <anish+git@lakhwara.com>
Reviewed-on: https://git.sealight.xyz/aynish/mast/pulls/4

aynish 176a81cc d46d6783

+51 -1
+2
.gitignore
··· 1 + *.sqlite 2 + mast
+3 -1
main.go cli/main.go
··· 7 7 "log" 8 8 "os" 9 9 10 - "mast/db" 10 + mast "mast/db" 11 11 12 12 "github.com/charmbracelet/bubbles/textinput" 13 13 tea "github.com/charmbracelet/bubbletea" ··· 89 89 panic(err) 90 90 } 91 91 92 + // TODO: 93 + // func sync_changes 92 94 rows, err := m.db.Query("SELECT * FROM crsql_changes") 93 95 if err != nil { 94 96 log.Println("Error querying crsql_changes:", err)
+46
server/test.go
··· 1 + package main 2 + 3 + import ( 4 + "encoding/base64" 5 + "fmt" 6 + "strconv" 7 + "strings" 8 + ) 9 + 10 + func decodeBase64ToIntArray(encodedString string) ([]int, error) { 11 + // Decode the base64 string 12 + decodedBytes, err := base64.StdEncoding.DecodeString(encodedString) 13 + if err != nil { 14 + return nil, fmt.Errorf("error decoding base64: %w", err) 15 + } 16 + 17 + // Convert bytes to string 18 + decodedString := string(decodedBytes) 19 + 20 + // Split the string by commas 21 + stringSlice := strings.Split(decodedString, ",") 22 + 23 + // Convert each string to an integer 24 + intSlice := make([]int, len(stringSlice)) 25 + for i, s := range stringSlice { 26 + num, err := strconv.Atoi(s) 27 + if err != nil { 28 + return nil, fmt.Errorf("error converting string to int: %w", err) 29 + } 30 + intSlice[i] = num 31 + } 32 + 33 + return intSlice, nil 34 + } 35 + 36 + func main2() { 37 + encodedString := "MSwxMSwzMiw1MCw5OCw1Nyw1Myw1NywxMDIsNTAsNTQsNTIsNTYsMTAyLDEwMCwxMDAsOTksNTEsNTQsNTcsMTAwLDk3LDEwMCwxMDIsMTAxLDU0LDQ5LDUzLDk5LDQ4LDEwMCw0OSw1NCwxMDIsNTI=" 38 + 39 + intArray, err := decodeBase64ToIntArray(encodedString) 40 + if err != nil { 41 + fmt.Println("Error:", err) 42 + return 43 + } 44 + 45 + fmt.Println("Decoded integer array:", intArray) 46 + }