Skip to content

Instantly share code, notes, and snippets.

@gwuah
gwuah / cart.js
Last active May 30, 2018 11:19
A simple cart store that can be used to persist state across all components and pages. no need VueX
import Vue from 'vue';
export const Store = new Vue({
data: function () {
return {
cart: [],
tax: 0,
totalItemsInCart: 0
}
},
@d-schmidt
d-schmidt / redirectExample.go
Last active March 12, 2024 08:04
How to redirect HTTP to HTTPS with a golang webserver.
package main
import (
"net/http"
"log"
)
func redirect(w http.ResponseWriter, req *http.Request) {
// remove/add not default ports from req.Host
target := "https://" + req.Host + req.URL.Path
if len(req.URL.RawQuery) > 0 {