helpers

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActualDate

func ActualDate(utcDate time.Time, lat, long float64) time.Time

func Base64Decode

func Base64Decode(str string) (string, error)

func CityFromCoords

func CityFromCoords(lat, lon float64) (string, error)

func DurationToMiles

func DurationToMiles(dur time.Duration) float32

DurationToMiles converts Durations to miles

func FileExists

func FileExists(path string) bool

FileExists simply returns true if a file exists

func GoogleMapsURL

func GoogleMapsURL(lat, long float64) string

GoogleMapsURL returns a google maps link to the coords provided TODO find query param for zoom level

func InvertMap

func InvertMap(m map[string]string) map[string]string

InvertMap takes a string map and returns it as value->key

func OpenInBrowser

func OpenInBrowser(url string)

TODO: text the admin if it errors opening browser?

func ParseLatLng

func ParseLatLng(ocrStr string) (float64, float64, error)

ParseLatLng converts an OCRed string into a LatLng

func PrintAllRoutes

func PrintAllRoutes(r *mux.Router)

func ProjectRoot

func ProjectRoot() string

ProjectRoot returns the root directory of the project

func ReadPidFile

func ReadPidFile(pidFile string) int

func RemoveNonLetters

func RemoveNonLetters(input string) string

func RunningOnDarwin

func RunningOnDarwin() bool

TODO: remove this and all darwin-only support RunningOnDarwin returns true if we're on darwin (OS X)

func RunningOnLinux

func RunningOnLinux() bool

RunningOnLinux returns true if we're on linux

func RunningOnWindows

func RunningOnWindows() bool

RunningOnWindows returns true if we're on windows

func SendSMS

func SendSMS(message string)

sends an SMS (to myself)

func SplitOnRegex

func SplitOnRegex(text string, delimeter string) []string

SplitOnRegex will is the equivalent of str.split(/regex/)

func StateAbbrevToState

func StateAbbrevToState(abbrev string) string

func StateFromCoords

func StateFromCoords(lat, lon float64) (string, error)

func StateToStateAbbrev

func StateToStateAbbrev(state string) string

func StripAtSign

func StripAtSign(username string) string

func SunsetStr

func SunsetStr(utcDate time.Time, lat, lon float64) string

func TitlecaseState

func TitlecaseState(state string) string

TODO: this doesnt handle the case where the state is invalid

func WritePidFile

func WritePidFile(pidFile string) error

this nastiness taken from: https://gist.github.com/davidnewhall/3627895a9fc8fa0affbd747183abca39 Write a pid file, but first make sure it doesn't exist with a running pid. TODO: consider refactoring to use PidExists()

Types

This section is empty.

Jump to

Keyboard shortcuts

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