This represents a proof of concept, minimal web stack. I used http://nicolasmerouze.com/build-web-framework-golang/ series of articles as a starting point and the goal was to keep the stack as minimal as possible while still being useful for practical purposes. And of course, use the standard library as much as possible and only integrate components compatible with it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This class creates a model of the Monty Hall problem. | |
# It simulates arranging the set with prize/goats, both guest | |
# and Monty picking a door and then the decision to switch | |
# or not to switch (and of course, the outcome). | |
# | |
# Each instance of the class (MontyHall.new) runs a new | |
# show. Sample usage code is at the bottom. | |
# | |
class MontyHall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Return full path to problem data file. | |
dataFileFullPath <- function(fname) { | |
paste("data", fname, sep="/") | |
} | |
# Returns solution for a given problem. | |
computeSolutionFor <- function(fname) { | |
# This is for the standard, python solver | |
#sol <- system(paste('python solver.py', dataFileFullPath(fname)), intern=T) | |
sol <- system(paste('./facility', dataFileFullPath(fname)), intern=T) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(RColorBrewer) | |
# Return full path to problem data file. | |
dataFileFullPath <- function(fname) { | |
paste("data", fname, sep="/") | |
} | |
# Returns solution for a given problem. | |
computeSolutionFor <- function(fname) { | |
cacheFile <- paste("solutions", fname, sep="/") |
Special thanks to https://scotch.io/tutorials/create-a-single-page-app-with-go-echo-and-vue for resparking my interest for frontend development. It's been a while... :)
- VueJS still rocks! :-) (as in, it's by far the biggest "heard of, would like to learn" (kind of what Go used to be, still is maybe?) and the 2nd most used);
- Bootstrap is still no.1 but https://tailwindcss.com/ is a serious challenger;
- CSS Grid Layout is getting more traction as an alternative to Flexbox for layout.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Chi-like syntactic sugar layer on top of stdlib http.ServeMux. | |
package main | |
import ( | |
"net/http" | |
"slices" | |
) | |
type ( | |
middleware func(http.Handler) http.Handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"net/url" | |
"fmt" | |
"github.com/tehmoon/errors" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/s3/s3manager" | |
"github.com/aws/aws-sdk-go/service/s3" | |
"io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] namespaces="git" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCx0x2FqQPAESrRfU8+TqqikuqB1F4OLDMkGdiZzsN19/59lLGPsZgQfejjHiujCWPRb0Tpz2Jv2mB6QcUVuK/gfiMbltwCdcDNCCa0I42xOgIHoYVatry7D8mZcy+t+e1TALrEUPCod4BEn8oLLnsGy6siDzv2hWINbIs2XLCvsOisa6xERgM1Joezo5+8IshSeP9felv6PqbfKEUWV0zfsoLbxJ0WAAM8T14OA/GIm12Dmg4fNWad70Bp1Yq/0W00vpZ9up+p8kMklZYlK6QHwrIw2gzVqsIL9x3FXgVw7KFRfV1Gp1W7V2S2sumzUW/BIztA0JOWqZnd0CMsSEyX |