Skip to content

Instantly share code, notes, and snippets.

View alexaandru's full-sized avatar

Alexandru Ungur alexaandru

View GitHub Profile
@alexaandru
alexaandru / chi.go
Created February 14, 2024 16:40
Chi-like syntactic sugar layer on top of stdlib http.ServeMux
// Chi-like syntactic sugar layer on top of stdlib http.ServeMux.
package main
import (
"net/http"
"slices"
)
type (
middleware func(http.Handler) http.Handler
@alexaandru
alexaandru / stf2017.md
Last active July 7, 2019 08:02
State of The Frontend. 2017

State of The Frontend

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... :)

2019 Update

@alexaandru
alexaandru / about.md
Last active July 31, 2017 11:16
Minimal Golang web stack.

Mini Go Web Stack

Description

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.

@alexaandru
alexaandru / routing.R
Last active August 29, 2015 14:00
Visualization of "Vehicle Routing" problems & solutions
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="/")
@alexaandru
alexaandru / facility.R
Last active October 21, 2020 13:53
Visualization of "Facility Location" problem datasets
# 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)
@alexaandru
alexaandru / monty_hall.rb
Created February 27, 2012 20:35
Monty Hall model in Ruby
#
# 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