xdotool search --onlyvisible --name firefox
This file contains hidden or 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 ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
) | |
type Rankings struct { | |
Keyword string |
This file contains hidden or 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
func scanFile() { | |
f, err := os.OpenFile(logfile, os.O_RDONLY, os.ModePerm) | |
if err != nil { | |
log.Fatalf("open file error: %v", err) | |
return | |
} | |
defer f.Close() | |
sc := bufio.NewScanner(f) | |
for sc.Scan() { |
This file contains hidden or 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 "fmt" | |
func main() { | |
var i interface{} = "hello" | |
s := i.(string) | |
fmt.Println(s) |
This file contains hidden or 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 handler | |
import ( | |
"net/http" | |
"net/http/httptest" | |
"strings" | |
"testing" | |
"github.com/labstack/echo" | |
"github.com/stretchr/testify/assert" |
This file contains hidden or 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
func main() { | |
u := User{Id: "US123", Balance: 8} | |
b := new(bytes.Buffer) | |
json.NewEncoder(b).Encode(u) | |
res, _ := http.Post("https://httpbin.org/post", "application/json; charset=utf-8", b) | |
var body struct { | |
// httpbin.org sends back key/value pairs, no map[string][]string | |
Headers map[string]string `json:"headers"` | |
Origin string `json:"origin"` | |
} |
This file contains hidden or 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
if err != nil { | |
switch err.(type) { | |
case *ErrZeroDivision: | |
fmt.Println(err.Error()) | |
default: | |
fmt.Println("What the h* just happened?") | |
} | |
} |
This file contains hidden or 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
import { shallowMount } from '@vue/test-utils'; | |
import HelloWorld from '@/components/HelloWorld.vue'; | |
describe('HelloWorld.vue', () => { | |
it('renders props.msg when passed', () => { | |
const msg = 'new message'; | |
const wrapper = shallowMount(HelloWorld, { | |
propsData: { msg }, | |
}); | |
expect(wrapper.text()).toMatch(msg); |
This file contains hidden or 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
image: golang:1.11 | |
variables: | |
TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA | |
RELEASE_CI_REGISTRY: registry.hub.docker.com | |
RELEASE_IMAGE: $RELEASE_CI_REGISTRY/brpaz/gitlab-mr-commenter:$CI_COMMIT_TAG | |
RELEASE_IMAGE_LATEST: $RELEASE_CI_REGISTRY/brpaz/gitlab-mr-commenter:latest | |
stages: | |
- test |
This file contains hidden or 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
PROJECT_NAME := "do-snapshot-pruner" | |
.SHELLFLAGS = -c # Run commands in a -c flag | |
.ONESHELL: ; # recipes execute in same shell | |
.NOTPARALLEL: ; # wait for this target to finish | |
.EXPORT_ALL_VARIABLES: ; # send all vars to shell | |
.DEFAULT_GOAL:=help | |
.PHONY: fmt lint vet test test-cover build-docker release help |