Skip to content

Commit

Permalink
Go test
Browse files Browse the repository at this point in the history
  • Loading branch information
techsideofficial committed Nov 20, 2023
1 parent 2828ade commit a2fcc81
Show file tree
Hide file tree
Showing 10 changed files with 917 additions and 0 deletions.
9 changes: 9 additions & 0 deletions progressbar/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
25 changes: 25 additions & 0 deletions progressbar/.gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

# Exclude main library which is used to run it locally
cmd/

# Exclude go.sum since it's generated before running it on the cloud
go.sum

# Exclude README, editorconfig, etc to save some bytes
README.md
.editorconfig
LICENSE
64 changes: 64 additions & 0 deletions progressbar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

#Example of color bars
colors-example/
21 changes: 21 additions & 0 deletions progressbar/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Gepser Hoil

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
77 changes: 77 additions & 0 deletions progressbar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Markdown Progress ![](https://geps.dev/progress/100)

Progress bars for markdown.

Have you ever wanted to track some progress in your markdown documents?
Well, I do, and I used `progressed.io` before but it was shutted down.

So I decided to recreate it.

## Usage

Add it as an image in your favorite markdown document, like this github readme, and change the progress number at the end.

![](https://geps.dev/progress/10)

> **Note**
> I'll try to keep this domain name up as much as possible, so wish me a long life 😁
## Examples

![](https://geps.dev/progress/10)

![](https://geps.dev/progress/50)

![](https://geps.dev/progress/75)

### Custom colors?

If you want to customize the colors you can use this query params:

dangerColor
warningColor
successColor

It will look like this:

![](https://geps.dev/progress/32?dangerColor=800000&warningColor=ff9900&successColor=006600)

And the results will look like this:


![](https://geps.dev/progress/10?dangerColor=800000&warningColor=ff9900&successColor=006600)

![](https://geps.dev/progress/50?dangerColor=800000&warningColor=ff9900&successColor=006600)

![](https://geps.dev/progress/75?dangerColor=800000&warningColor=ff9900&successColor=006600)

## Deploy

So if you want to host it and have your own domain, you can just deploy it on your preferred cloud.

It's straight forward for GCP but with some little changes you can do the same for any cloud since this is a simple function (or lambda).

### Google Cloud

Login and set the project in `gcloud` if you are not already logged in.

gcloud auth login
gcloud config set project THE_PROJECT_NAME

Deploy it as an HTTP Cloud Function with the `Progress` entrypoint.

gcloud functions deploy progress --runtime go119 --entry-point Progress --trigger-http --memory 128MB --allow-unauthenticated

## Test it locally

Build the project so it downloads the dependencies

go build

Run it

go run cmd/main.go

You can visit the endpoint in your favorite browser, for example:

http://localhost:8080/progress/76
21 changes: 21 additions & 0 deletions progressbar/cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"log"
"os"

// Blank-import the function package so the init() runs
_ "geps.dev/progress"
"github.com/GoogleCloudPlatform/functions-framework-go/funcframework"
)

func main() {
// Use PORT environment variable, or default to 8080.
port := "8080"
if envPort := os.Getenv("PORT"); envPort != "" {
port = envPort
}
if err := funcframework.Start(port); err != nil {
log.Fatalf("funcframework.Start: %v\n", err)
}
}
17 changes: 17 additions & 0 deletions progressbar/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module geps.dev/progress

go 1.19

require github.com/GoogleCloudPlatform/functions-framework-go v1.6.1

require (
cloud.google.com/go/functions v1.0.0 // indirect
github.com/cloudevents/sdk-go/v2 v2.6.1 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/json-iterator/go v1.1.10 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.10.0 // indirect
)
Loading

0 comments on commit a2fcc81

Please sign in to comment.