useless

package module
v0.0.0-...-a5d261b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

README

GoDoc Go Report Card

import "github.com/baraa-almasri/useless"

This library is just useless!

what doesn't it do?
  1. YTPlayer meme songs youtube player(uses a music source songs.Songs)
  2. RandASCII random ASCII generator
  3. StringsExtended more strings functions!
  4. csvconv.CSVConverter csv converter, so far just csvconv.HTMLConverter and csvconv.MarkdownConverter
  5. UniqueID a somehow unique id generator :)
see pretty much useless :)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RandASCII

type RandASCII struct {
	// contains filtered or unexported fields
}

RandASCII generates a random string or char

func NewRandASCII

func NewRandASCII() *RandASCII

NewRandASCII returns a new RandASCII instance

func (*RandASCII) GetRandomAlphanumChar

func (r *RandASCII) GetRandomAlphanumChar() uint8

GetRandomAlphanumChar returns a random alphanumeric ASCII character

func (*RandASCII) GetRandomAlphanumString

func (r *RandASCII) GetRandomAlphanumString(length int) string

GetRandomString returns a random alphanumeric ASCII string of a given length

func (*RandASCII) GetRandomChar

func (r *RandASCII) GetRandomChar() uint8

GetRandomChar returns a random (alphanumeric and special) ASCII character

func (*RandASCII) GetRandomString

func (r *RandASCII) GetRandomString(length int) string

GetRandomString returns a random ASCII string of a given length

type StringsExtended

type StringsExtended struct{}

StringsExtended has string operations that are not in the "strings" module

func NewExtendedStrings

func NewExtendedStrings() *StringsExtended

NewExtendedStrings returns a new StringsExtended instance

func (*StringsExtended) GetStringArrayFromJSON

func (s *StringsExtended) GetStringArrayFromJSON(jsonFile io.Reader, arrayName ...string) ([]string, error)

GetStringArrayFromJSON returns a string array with a specific name from a json file if an array name is provided it returns that specific array, otherwise the whole json is an array :)

func (*StringsExtended) GetStringArrayFromJSONBytes

func (s *StringsExtended) GetStringArrayFromJSONBytes(jsonBytes []byte, arrayName ...string) ([]string, error)

GetStringArrayFromJSONBytes is same as GetStringArrayFromJSON but it receives a byte array that has the JSON data instead

func (*StringsExtended) MakeSpongeBobCase

func (s *StringsExtended) MakeSpongeBobCase(str string, startLower ...bool) string

MakeSpongeBobCase returns the given in SpOnGeBoBcAsE also it receives an optional flag to start string with lower case, default value = false

type UniqueID

type UniqueID struct {
	// contains filtered or unexported fields
}

UniqueID is a wrapping for a somehow unique id generator

func NewUniqueID

func NewUniqueID(charRandomizer *RandASCII) *UniqueID

NewUniqueID returns a new UniqueID instance

func (*UniqueID) GetUniqueString

func (uid *UniqueID) GetUniqueString(additionalLength ...int) string

GetUniqueString returns a unique string generated from the current timestamp mixed with some random characters and adds an additional random chars to it if needed :)

func (*UniqueID) GetUniqueStringWithPrefix

func (uid *UniqueID) GetUniqueStringWithPrefix(prefix string, additionalLength ...int) string

GetUniqueStringWithPrefix same as GetUniqueString but adds a prefix to the generated string

type YTPlayer

type YTPlayer struct {
	// contains filtered or unexported fields
}

YTPlayer plays youtube songs using the system's default browser

func NewYTPlayer

func NewYTPlayer(source songs.Songs) *YTPlayer

NewYTPlayer returns a new YTPlayer instance

func (*YTPlayer) PlayRandomSong

func (yt *YTPlayer) PlayRandomSong() error

PlayRandomSong plays a random song from the given music source

func (*YTPlayer) PlaySong

func (yt *YTPlayer) PlaySong(song string) error

PlaySong launches default browser and plays the given url

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL