Skip to content

Instantly share code, notes, and snippets.

@fulldump
fulldump / parallel.go
Created October 14, 2025 13:31
Go parallel
func Parallel(workers int, f func()) {
wg := &sync.WaitGroup{}
for i := 0; i < workers; i++ {
wg.Add(1)
go func() {
defer wg.Done()
f()
}()
}
func TestEjemploGoParaAllan(t *testing.T) {
b := NewBox()
db := &Database{}
b.HandleResourceNotFound = func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
w.Write([]byte("HEY! Not Found"))
@fulldump
fulldump / main.go
Created March 24, 2025 17:10
Inbound email server in golang
package main
import (
"bufio"
"fmt"
"log"
"net"
"strings"
"github.com/fulldump/goconfig"
@fulldump
fulldump / placeholders.go
Last active May 29, 2024 12:05
Golang Placeholders
package placeholders
import (
"regexp"
"strings"
)
var placeholders = regexp.MustCompile(`{{([^}]*)}}`)
func Traverse(input string, callback func(string) string) (output string) {
@fulldump
fulldump / createNote.js
Created February 10, 2024 04:00
Application 'MyNotes' from scratch on hola.cloud
// POST /notes
let a = auth();
let user_id = a.user.id;
// inception credentials
let credentials = {
"database_id": "0629698a-2de5-491a-852a-8041e3fa5dd4",
"api_key": "dd38017d-8d8d-40a7-88bf-3141e03355b5",
"api_secret": "616ca676-b3e5-4a8a-a725-b03417f5362b"

write(string)

Description: This function is used to write a response body to the HTTP request. It takes a string as its argument and sends it as the response content to the client. Example in JavaScript:

write("Hello, World!");

writeStatus(int)

@fulldump
fulldump / openapi.go
Created October 18, 2023 16:17
Openapi example
package openapi
import (
"context"
"net/http"
"reflect"
"strings"
"github.com/fulldump/box"
)
package main
import (
"crypto/tls"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
@fulldump
fulldump / manipulator.go
Created April 21, 2023 09:53 — forked from gerardojimenezform3/manipulator.go
Manipulator - a wrapper to set and get attributes from any struct to prevent nil pointers and other issues
package manipulator
import (
"fmt"
"reflect"
"strings"
)
type Manipulator struct {
any