Skip to content

Commit

Permalink
ID: REFA changes
Browse files Browse the repository at this point in the history
  • Loading branch information
marianolabarinas committed May 26, 2017
0 parents commit 48e9f29
Show file tree
Hide file tree
Showing 73 changed files with 1,473 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Golang Tutorial

<p align="center">
<img src="https://howtolearn.me/wp-content/uploads/2015/05/golang-logo.png"/>
</p>

##Questions?

Ask [email protected]

Ask [email protected]
Binary file added go-talks/resources/Ejercicios.pdf
Binary file not shown.
Binary file added go-talks/resources/caso_de_uso.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/cockroach.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/docker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/dropbox.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/fury1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/fury2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/gingonic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/gingonic_middlewares.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/gingonic_snippets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/gustavo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/kubernetes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations_hardware.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/locations_metrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/mariano.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/others.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/slice1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added go-talks/resources/slice2.png
Binary file added go-talks/resources/slice3.png
Binary file added go-talks/resources/slices.png
9 changes: 9 additions & 0 deletions go-talks/resources/src/00_hello_world/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

import (
"fmt"
)

func main() {
fmt.Println("Hello, 世界")
}
16 changes: 16 additions & 0 deletions go-talks/resources/src/01_zero_values/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import "fmt"

var i int
var f float64
var b bool
var s string

func init(){
fmt.Println("Se ejecuta init")
}

func main() {
fmt.Printf("%v %v %v %q\n", i, f, b, s)
}
17 changes: 17 additions & 0 deletions go-talks/resources/src/02_iterations/0/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package main

import (
"fmt"
)

func main() {
var s string

args:=[]string{"arg1","arg2","arg3","arg4"}

for i := 0; i < len(args); i++ {
s += args[i] + " "
}

fmt.Println("Result 1: " + s)
}
18 changes: 18 additions & 0 deletions go-talks/resources/src/02_iterations/1/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"fmt"
)

func main() {
var s string
args:=[]string{"arg1","arg2","arg3","arg4"}

i := 0
for i < len(args) {
s += args[i] + " "
i++
}

fmt.Println("Result 2: " + s)
}
20 changes: 20 additions & 0 deletions go-talks/resources/src/02_iterations/2/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import (
"fmt"
)

func main() {
var s string
args:=[]string{"arg1","arg2","arg3","arg4"}

i := 0
for {
if i >= len(args) {
break
}
s += args[i] + " "
i++
}
fmt.Println("Result 3: " + s)
}
15 changes: 15 additions & 0 deletions go-talks/resources/src/02_iterations/3/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
"fmt"
)

func main() {
var s string
args:=[]string{"arg1","arg2","arg3","arg4"}

for _, value := range args {
s += value + " "
}
fmt.Println("Result 4: " + s)
}
19 changes: 19 additions & 0 deletions go-talks/resources/src/02_iterations/4/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
"fmt"
"runtime"
)

func main() {
fmt.Print("Go runs on ")

switch os := runtime.GOOS; os {
case "darwin":
fmt.Println("OS X.")
case "linux":
fmt.Println("Linux.")
default:
fmt.Printf("%s.", os)
}
}
14 changes: 14 additions & 0 deletions go-talks/resources/src/03_functions/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package main

import "fmt"

func swap(x, y string) (string, string) {
return y, x
}

func main() {
a, b := swap("hello", "world")
fmt.Println(a, b)
a, b = b,a
fmt.Println(a, b)
}
15 changes: 15 additions & 0 deletions go-talks/resources/src/04_packages/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package main

import (
"fmt"
"github.com/rodriguezgustavo/go-talks/2016-10-BsAs/resources/src/4_packages/math"
)

func main() {
var result int
args:=[]int{1,2,3,4}
for _, val := range args {
result = math.Add(result, val)
}
fmt.Printf("Suma: %d\n", result)
}
5 changes: 5 additions & 0 deletions go-talks/resources/src/04_packages/math/math.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package math

func Add(x, y int) int {
return x + y
}
13 changes: 13 additions & 0 deletions go-talks/resources/src/05_variables_type_convertion/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package main

import (
"fmt"
"math"
)

func main() {
var x, y int = 3, 4
var f float64 = math.Sqrt(float64(x*x + y*y))
var z uint = uint(f)
fmt.Println(x, y, z)
}
20 changes: 20 additions & 0 deletions go-talks/resources/src/06_pointers/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import (
"fmt"
"strconv"
)

func main() {
x := 4
fmt.Println("X Value:" + strconv.Itoa(x))
y := new(int)
fmt.Println("Y Value:" + strconv.Itoa(*y))
*y = 4
fmt.Println("Y Value:" + strconv.Itoa(*y))
if y == &x {
fmt.Println("X & Y are equals")
} else {
fmt.Println("X & Y are not equals")
}
}
19 changes: 19 additions & 0 deletions go-talks/resources/src/06_pointers_flags/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
"flag"
"fmt"
"strings"
)

var n = flag.Bool("n", false, "Omitir tailing")

var sep = flag.String("s", " ", "Separador")

func main() {
flag.Parse()
fmt.Print(strings.Join(flag.Args(), *sep))
if !*n {
fmt.Println()
}
}
43 changes: 43 additions & 0 deletions go-talks/resources/src/07_types/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package main

import (
"fmt"
)


// START OMIT

type Celsius float64
type Fahrenheit float64

const AbsoluteZeroC Celsius = -273.15
const FreezingC Celsius = 0
const BoilingC Celsius = 100

func (c Celsius) String() string {
return fmt.Sprintf("%g°C", c)
}

func (f Fahrenheit) String() string {
return fmt.Sprintf("%g°F", f)
}

func CToF(c Celsius) Fahrenheit {
return Fahrenheit(c*9/5 + 32)
}

func FToC(f Fahrenheit) Celsius {
return Celsius((f - 32) * 5 / 9)
}

// END OMIT

func main() {
args:= []float64{15,2, 20, 100, 120}
for _, t := range args {
f := Fahrenheit(t)
c := Celsius(t)
fmt.Printf("%s = %s, %s = %s\n",
f, FToC(f).String(), c, CToF(c).String())
}
}
38 changes: 38 additions & 0 deletions go-talks/resources/src/08_structs/sort.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package sort

type tree struct {
value int
left, right *tree
}

func Sort(values []int) {
var root *tree
for _, v := range values {
root = add(root, v)
}
appendValues(values[:0], root)
}

func appendValues(values []int, t *tree) []int {
if t != nil {
values = appendValues(values, t.left)
values = append(values, t.value)
values = appendValues(values, t.right)
}
return values
}

func add(t *tree, value int) *tree {
if t == nil {
// Equivalent to return &tree{value: value}.
t = new(tree)
t.value = value
return t
}
if value < t.value {
t.left = add(t.left, value)
} else {
t.right = add(t.right, value)
}
return t
}
18 changes: 18 additions & 0 deletions go-talks/resources/src/08_structs/sort_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package sort

import (
"math/rand"
"sort"
"testing"
)

func TestSort(t *testing.T) {
data := make([]int, 50)
for i := range data {
data[i] = rand.Int() % 50
}
Sort(data)
if !sort.IntsAreSorted(data) {
t.Errorf("not sorted: %v", data)
}
}
18 changes: 18 additions & 0 deletions go-talks/resources/src/09_collections/1/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"fmt"
)

func main() {
a := [2]string{"1", "2"}
b := [...]string{"1", "2"}
c := [2]string{"1","3"}

fmt.Println(c[0], c[len(a)-1] )
fmt.Println( a == b, a==c)

for _, value := range a {
fmt.Print(value+" ")
}
}
19 changes: 19 additions & 0 deletions go-talks/resources/src/09_collections/2/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
"fmt"
)

func main() {
a1 := [...]int{1,2,3}

s1 := a1[0:2] // same as s1:=a1[:2]
var s2 []int // len(s2) == 0 , s2== nil
s3 := make([]int, 2) //len(s3) ==2 , cap==2. Same as make([]int,2,2)

s1 = append(s1, 5)
s2 = append(s2, 5)
s3 = append(s3, 5)

fmt.Println(s1 , s2 , s3)
}
20 changes: 20 additions & 0 deletions go-talks/resources/src/09_collections/3/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package main

import (
"fmt"
)

func main() {
m := make(map[int]int)
var m2 map[int]int

m[1] = 1
m[2] = 2
m[3] = 3
delete(m,3)

fmt.Println(m2==nil) //panic if m2[0]=1
for key, value := range m {
fmt.Printf("Key: %d, Value: %d \n", key, value)
}
}
Loading

0 comments on commit 48e9f29

Please sign in to comment.