Skip to content

Instantly share code, notes, and snippets.

@jmilet
jmilet / gulpfile.js
Last active November 26, 2017 12:27
Gulp file to reformat js code as it's being saved
/*
npm install gulp-cli -g
npm install gulp -D
npm install js-beautify
touch gulpfile.js
gulp --help
*/
@jmilet
jmilet / tsl_gzip_http_server.go
Last active November 12, 2017 15:47
Go: TSL gzip http server
package main
import (
"compress/gzip"
"io"
"log"
"net/http"
"strings"
"time"
)
@jmilet
jmilet / map_sample.go
Created November 12, 2017 11:51
Go: Simple map sample using 'ok' return value
package main
import "fmt"
func main() {
data := map[string]string{
"one": "the number one",
"two": "the number two",
}
@jmilet
jmilet / flag_poc.go
Created November 12, 2017 11:06
Go: Simple flag example
package main
import (
"flag"
"fmt"
)
var ip = flag.Int("flagname", 1234, "help message for flagname")
func main() {
@jmilet
jmilet / remove_element_slice.go
Created November 12, 2017 08:00
Go: How to remove an element from an slice
package main
import (
"fmt"
)
func main() {
values := []string{"uno", "dos", "tres"}
fmt.Println(values)
@jmilet
jmilet / gist:c1d138e6594ac2cb4eca46cfbedb4213
Last active November 11, 2017 22:22
Useful regular expressions
Two parameters ignoring trailing spaces and slash characters
============================================================
Go:
^/(.+?)/(.+?)/*\s*$
Lua:
> return string.gsub("/aaa/bbb//// ", "^/(.-)/(.-)/- -$", "%1 %2")