Skip to content

Instantly share code, notes, and snippets.

@elkcityhazard
elkcityhazard / net_listener_http_server_example.go
Last active March 2, 2025 14:19
A simple http server using net.Listen
package main
import (
"bufio"
"bytes"
"fmt"
"html/template"
"log"
"net"
"strings"
@elkcityhazard
elkcityhazard / am_router.go
Created January 2, 2025 02:30
AM Custom Router Package
package amrouter
import (
"context"
"embed"
"errors"
"fmt"
"net/http"
"regexp"
"strings"
@elkcityhazard
elkcityhazard / main.go
Last active January 2, 2025 02:00
A basic go http webserver that uses my custom router implementation
package main
import (
"fmt"
"log"
"net/http"
"strings"
amrouter "github.com/elkcityhazard/am-router"
)
@elkcityhazard
elkcityhazard / coolDownCounter.js
Last active July 5, 2024 14:18
Implement the classic counter that slows down as it gets closer to it's limit (I call it a cooldown timer)
class CountUp {
constructor(elID = "", currentIndex = 0, limit = 100, baseInterval = 30, coolDown = 90) {
this.elID = elID
this.element = document.getElementById(elID)
this.currentIndex = +currentIndex
this.limit = +this.element.dataset['count']
this.baseInterval = +baseInterval
this.coolDown = +coolDown
this.percentOf = Math.floor(this.limit * this.coolDown / 100)
this.initCountUp()