Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
learning haskell

bashbunni bashbunni

🔥
learning haskell
View GitHub Profile
@bashbunni
bashbunni / main.go
Created Jan 11, 2023
Redirect Output From Program
View main.go
package main
import (
"bytes"
"fmt"
"os"
"os/exec"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@bashbunni
bashbunni / diff.txt
Last active Jan 11, 2023
Validate Min Length Credit Card Example Bubble Tea
View diff.txt
131a132,145
> func (m model) checkMinLen() error {
> var err error
>
> c := m.inputs[m.focused]
> if len(c.Value()) != c.CharLimit {
> err = fmt.Errorf(
> "%s should be at least %d characters",
> c.Value(),
> c.CharLimit,
@bashbunni
bashbunni / main.go
Created Jan 11, 2023
ValidateFunc Blocking Workaround
View main.go
package main
import (
"fmt"
"log"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/textinput"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@bashbunni
bashbunni / .zshrc
Created Jan 4, 2023
CLI Pomodoro for Linux
View .zshrc
# study stream aliases
# Requires https://github.com/caarlos0/timer to be installed. spd-say should ship with your distro
declare -A pomo_options
pomo_options["work"]="45"
pomo_options["break"]="10"
pomodoro () {
if [ -n "$1" -a -n "${pomo_options["$1"]}" ]; then
val=$1
@bashbunni
bashbunni / main.go
Created Dec 21, 2022
Bubbles Table Customization
View main.go
package main
/* This gist shows a table bubble with custom styles and a special case
where the row will get highlighted red to show how to do conditional formatting*/
import (
"fmt"
"os"
"github.com/charmbracelet/bubbles/table"
@bashbunni
bashbunni / .zshrc
Created Oct 27, 2022
CLI Pomodoro for Mac
View .zshrc
# I'll be doing another one for Linux, but this one will give you
# a pop up notification and sound alert (using the built-in sounds for macOS)
# Requires https://github.com/caarlos0/timer to be installed
# Mac setup for pomo
alias work="timer 60m && terminal-notifier -message 'Pomodoro'\
-title 'Work Timer is up! Take a Break 😊'\
-appIcon '~/Pictures/pumpkin.png'\
-sound Crystal"
@bashbunni
bashbunni / go.mod
Last active Oct 27, 2022 — forked from SamWolfs/delegate.go
Bubbles list: no full screen if secondary state
View go.mod
module gh
go 1.19
require (
github.com/charmbracelet/bubbles v0.14.0
github.com/charmbracelet/bubbletea v0.22.1
)
require (
@bashbunni
bashbunni / main.go
Created Sep 7, 2022
Toggle Between List Examples
View main.go
package main
import (
"fmt"
"os"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
@bashbunni
bashbunni / main.go
Created Sep 7, 2022
Recolor Selected Items in List Bubble
View main.go
package main
import (
"fmt"
"os"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
)
View main.go
import (
tea "github.com/charmbracelet/bubbletea"
)
func main() {
// init models, we can reset them at any time anyway
models = []tea.Model{NewInitialModel(), NewSpinnerParent()}
m := models[initialView]
p := tea.NewProgram(m)
if err := p.Start(); err != nil {