Skip to content

Instantly share code, notes, and snippets.

View arturo-source's full-sized avatar

Arturo Martínez arturo-source

View GitHub Profile
@arturo-source
arturo-source / main.go
Created April 5, 2024 10:17
Server Side Event (sse) example with Go
package main
import (
"fmt"
"net/http"
"time"
)
var html = []byte(`
<!DOCTYPE html>
@arturo-source
arturo-source / csv2json.go
Created March 15, 2024 08:33
Convert easily a CSV into a JSON using Go
package main
import (
"encoding/csv"
"encoding/json"
"flag"
"fmt"
"os"
"path/filepath"
"strconv"
@arturo-source
arturo-source / main.go
Created February 26, 2024 09:50
How to access to OpenAI API with Golang
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
@arturo-source
arturo-source / main.go
Last active January 28, 2023 12:43
Virus that stoles all your files from the computer.
package main
import (
"archive/zip"
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
@arturo-source
arturo-source / main.go
Last active May 2, 2023 12:30
Go HTTP server to show if client request is working as expected.
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
)
func defaultHandler(res http.ResponseWriter, req *http.Request) {
@arturo-source
arturo-source / pagination.js
Last active March 12, 2024 08:45
Simple pagination JS script. Paginator class is 100 lines of JavaScript code to paste into your project and easily handle an array of elements.
class Paginator {
constructor({
elements,
cellsPerRow = 5,
rowsPerPage = 4,
renderFunc,
prevBtn,
nextBtn,
firstBtn,
lastBtn,