Skip to content

Instantly share code, notes, and snippets.

@gocs
gocs / go-contracts-proposal-thingy.go
Created May 1, 2020 19:08
go contracts proposal thingy
// Copyright 2020 github.com/gocs
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@gocs
gocs / hugo.sh
Created April 18, 2020 14:34
hugo new site in current folder/directory or without making a folder inside the repo
#!/usr/bin/env bash
hugo new site quickstart && mv ./quickstart/* . && rm -rf ./quickstart
@gocs
gocs / ~\.omnisharp\omnisharp.json
Last active December 20, 2019 15:27
vscode omnisharp inside whole pc userspace k and r braces
{
"FormattingOptions": {
"NewLinesForBracesInLambdaExpressionBody": false,
"NewLinesForBracesInAnonymousMethods": false,
"NewLinesForBracesInAnonymousTypes": false,
"NewLinesForBracesInControlBlocks": false,
"NewLinesForBracesInTypes": false,
"NewLinesForBracesInMethods": false,
"NewLinesForBracesInProperties": false,
"NewLinesForBracesInAccessors": false,
@gocs
gocs / goroutine.go
Created April 8, 2019 14:44
goroutine that counts while sleeping
package main
import (
"fmt"
"time"
)
func count(quit chan bool) {
count := 0
for {
@gocs
gocs / goroutine.go
Created April 8, 2019 14:19
goroutine with channels life cycle
package main
import "fmt"
func do_stuff(done chan bool) {
fmt.Println("2")
done <- true
fmt.Println("3")
}
@gocs
gocs / goroutine.go
Last active April 8, 2019 13:39
goroutine lifecycle
package main
import (
"fmt"
"time"
)
func sync() {
time.Sleep(time.Second / 2)
fmt.Println("1")