Skip to content

Instantly share code, notes, and snippets.

View brpaz's full-sized avatar

Bruno Paz brpaz

View GitHub Profile
// In the main process.
const { BrowserView, BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 600 })
win.on('closed', () => {
win = null
})
let view = new BrowserView({
webPreferences: {
package com.mkyong.java8;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class TestJava8 {
public static void main(String[] args) {
@brpaz
brpaz / CODE_OF_CONDUCT.md
Last active May 2, 2024 02:30
A Code of Conduct for Open Source Projects - https://www.contributor-covenant.org/

Contributor Covenant Code of Conduct

Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.

@brpaz
brpaz / markdown-cheatsheet.md
Created February 1, 2019 22:22
A better markdown cheatsheet.
@brpaz
brpaz / xdtool.md
Created February 3, 2019 10:42
Set window size with xdtool #xdtool #linux

Set window size with xdtool

Find the window ID:

xdotool search --onlyvisible --name firefox

Set the window size

@brpaz
brpaz / Makefile
Last active April 25, 2020 17:09
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
@brpaz
brpaz / .gitlab-ci.yml
Created February 16, 2019 19:08
#gitlab #docker
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
@brpaz
brpaz / example.spec.js
Created March 12, 2019 21:52
#vuejs #testing
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);
@brpaz
brpaz / main.go
Created March 15, 2019 19:57
#golang
if err != nil {
switch err.(type) {
case *ErrZeroDivision:
fmt.Println(err.Error())
default:
fmt.Println("What the h* just happened?")
}
}
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"`
}