Skip to content

Instantly share code, notes, and snippets.

@dexterp
dexterp / inject.go
Last active April 30, 2024 08:12
GO Injector
package inject
type Config struct {
}
type Inject struct {
cfg Config
}
func New(c Config) *Inject {
@dexterp
dexterp / injector.dart
Last active April 22, 2024 03:52
DART Injector
class Injector {
List<String>? list;
List<String> makeList() {
list ??= <String>["a", "b", "c"]; // return (list ??= ...); // compact
return list!;
}
}
@dexterp
dexterp / tailwindccs.html
Last active April 11, 2024 22:19
CSSTW html starter
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
</body>
@dexterp
dexterp / gridcss.html
Last active April 11, 2024 21:30
CSS Grid Body
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
margin: 0;
padding: 0;
@dexterp
dexterp / errs.go
Last active May 3, 2024 18:26
GO Error wrapping in Go
// Code is error kind
package errs
import (
"errors"
"fmt"
"internal/resrc/call"
)
@dexterp
dexterp / callinfo.go
Last active April 11, 2024 19:14
GO Function to retrieve call information
package call
import (
"path"
"runtime"
"strings"
)
type Info struct {
Dir string
@dexterp
dexterp / shutdown.go
Last active April 30, 2024 07:46
GO Shutdown
package shutdown
import (
"os"
"os/signal"
"sync"
"syscall"
"time"
"github.com/go-playground/validator/v10"
@dexterp
dexterp / move.go
Last active April 11, 2024 19:15
GO Move Files Across devices
package main
import (
"errors"
"fmt"
"io"
"os"
"path/filepath"
"strings"
)
@dexterp
dexterp / testtools.go
Last active April 11, 2024 19:19
GO testtools.go
package testtools
import (
"path"
"path/filepath"
"runtime"
)
// FixtureDir returns the path to the fixture directory.
func FixtureDir() (fixturedir string) {