Skip to content

Instantly share code, notes, and snippets.

View arxdsilva's full-sized avatar
:octocat:
Working from home

Arthur Silva arxdsilva

:octocat:
Working from home
View GitHub Profile
Verifying that "arxdsilva.id" is my Blockstack ID. https://onename.com/arxdsilva
@arxdsilva
arxdsilva / comparer.go
Created August 16, 2017 13:32
comparing two slices in go
func compare(a, b []string) []string {
for i := len(a) - 1; i >= 0; i-- {
for _, vD := range b {
if a[i] == vD {
a = append(a[:i], a[i+1:]...)
break
}
}
}
return a
@arxdsilva
arxdsilva / comparer.go
Last active August 16, 2017 13:54
comparer with maps
func compare(original, translation map[string]string) map[string]string {
missing := make(map[string]string)
for k, v := range original {
if _, ok := translation[k]; !ok {
missing[k] = v
}
}
return missing
}
@arxdsilva
arxdsilva / pizza.go
Last active November 28, 2017 11:41
Golang concurrency using method example and pizza orders
package main
import (
"fmt"
"sync"
)
type PizzaOrder struct {
orderNum int
flavor string
package com.example.influenciadores;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
public class InfluenciadoresActivity extends Activity {
{
"manifest_version": 2,
"name": "Getting started example",
"description": "This extension allows the user to change the background color of the current page.",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
@arxdsilva
arxdsilva / main.go
Created February 4, 2019 01:48
Tibia's house rental prices info
package main
import (
"bufio"
"fmt"
"net/http"
"os"
"strconv"
"strings"
)
@arxdsilva
arxdsilva / main.go
Created May 10, 2019 22:52
utf8 rune count in string
package main
import "fmt"
import "unicode/utf8"
func main() {
fmt.Println("Hello, 世界", len("世界"), utf8.RuneCountInString("世界"))
}
@arxdsilva
arxdsilva / fakeserver.go
Created June 5, 2019 17:39
fake server golang
package main
import (
"fmt"
"net/http"
"time"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
@arxdsilva
arxdsilva / timeout.go
Last active May 6, 2020 14:03
request timeout in golang
package main
import (
"fmt"
"io/ioutil"
"net/http"
"time"
)
func main() {