Skip to content

Instantly share code, notes, and snippets.

@AxelRHD
AxelRHD / channeling.go
Last active July 31, 2018 21:28
Golang Snippets
package main
import (
"fmt"
"sync"
"time"
)
type message struct {
data int
@AxelRHD
AxelRHD / go_middleware.go
Last active August 13, 2024 15:56
GO middleware example (with gorilla/mux)
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/context"
"github.com/gorilla/mux"
)
@AxelRHD
AxelRHD / Makefile
Created July 18, 2019 19:44
Makefile for GO
# Go
GOCMD=go
XGO=xgo
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
BINARY_NAME=my-app
exec: run clean
@AxelRHD
AxelRHD / goroutine-shutdown-channel.go
Created August 19, 2019 13:11
Shutdown multiple goroutines over channel
package main
import (
"log"
"sync"
"time"
)
func main() {
var wgDone sync.WaitGroup

Keybase proof

I hereby claim:

  • I am AxelRHD on github.
  • I am axelrhd (https://keybase.io/axelrhd) on keybase.
  • I have a public key whose fingerprint is 43A8 8F88 AD3E 4CEE 220D D4BB 2821 E9A5 A558 BB69

To claim this, I am signing this object:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>My HTML Boilerplate</title>
</head>
<body>
<script src="./main.js"></script>
@AxelRHD
AxelRHD / index.html
Last active January 24, 2021 00:37
Cycle JS - counter M-V-I
<!DOCTYPE html>
<html>
<head>
<script src="https://npmcdn.com/[email protected]/dist/xstream.min.js"></script>
<script src="https://npmcdn.com/@cycle/[email protected]/dist/cycle-dom.min.js"></script>
<script src="https://npmcdn.com/@cycle/[email protected]/dist/cycle.min.js"></script>
<script src="https://npmcdn.com/@cycle/[email protected]/dist/cycle-http-driver.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
@AxelRHD
AxelRHD / boilerplate.jsx
Created November 18, 2021 20:45
Cycle JS boilerplate with JSX
import xs from 'xstream';
import { run } from '@cycle/run';
import { makeDOMDriver } from '@cycle/dom';
// import { makeHTTPDriver } from '@cycle/http';
import Snabbdom from 'snabbdom-pragma';
const intent = sources => {
return {
@AxelRHD
AxelRHD / Caddyfile
Last active November 3, 2022 19:59
Elm-SPA with Caddy Dev-Server
{
auto_https off
admin :2020
}
:1235 {
handle_path /api* {
reverse_proxy :3005 #pointing to a dev-api-server
}
@AxelRHD
AxelRHD / app.tsx
Created November 12, 2022 12:37
Cycle.JS with JSX, Typescript and Parcel (Primer)
import { jsx, VNode } from "snabbdom";
import xs from "xstream";
import { Stream } from "xstream";
import run from "@cycle/run";
import { MainDOMSource, makeDOMDriver } from "@cycle/dom";
import { IStreams, ISources } from "./interfaces";
import { Navbar } from './components/navbar'