Skip to content

Commit d626510

Browse files
author
Josh Rosenstein
committed
first commit
0 parents  commit d626510

File tree

2,998 files changed

+111493
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,998 files changed

+111493
-0
lines changed

.gitignore

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
13+
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
19+
20+
_testmain.go
21+
22+
*.exe
23+
*.test
24+
*.prof
25+
26+
# WebStorm
27+
*.iml
28+
29+
# Directory-based project format:
30+
.idea/
31+
.idea/workspace.xml
32+
**/.idea/workspace.xml
33+
34+
35+
# mac hidden files
36+
.DS_Store
37+
38+
#other
39+
node_modules/
40+
bower_components/
41+
.tmp
42+
.sass-cache
43+
builds/**/images/*
44+
*.ogg
45+
*.mp3
46+
*.mp4
47+
#*.png
48+
#*.jpeg
49+
50+
# security / ssl
51+
*.pem
52+
*.xxjson
53+
54+
# Elastic Beanstalk Files
55+
.elasticbeanstalk/*
56+
!.elasticbeanstalk/*.cfg.yml
57+
!.elasticbeanstalk/*.global.yml
58+
59+
# Other
60+
**/000_temp/56*
61+
**/000_temp/57*

000_temp/01_rand/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"math/rand"
6+
"time"
7+
)
8+
9+
func main() {
10+
rand.Seed(time.Now().Unix())
11+
x := rand.Intn(3)
12+
fmt.Println(x)
13+
}

000_temp/02_hello/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
)
6+
7+
func main() {
8+
x := "Hello, class!"
9+
fmt.Println(x)
10+
}

000_temp/03_christmas/letter.phpasp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
{{range .}}
3+
*************************************
4+
Merry Christmas, {{.}} -
5+
6+
I hope the holiday season finds you well.
7+
8+
Blah blah blah.
9+
10+
Happy New Year, too!
11+
The McLeods
12+
{{end}}

000_temp/03_christmas/main.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"text/template"
7+
)
8+
9+
func main() {
10+
tpl, err := template.ParseFiles("letter.phpasp")
11+
if err != nil {
12+
fmt.Println("There was an error parsing file", err)
13+
}
14+
15+
friends := []string{"Alex", "Conor", "Ken", "Ronnie", "Patick", "Nina", "Jeremy", "Gentry", "Christian"}
16+
17+
err = tpl.Execute(os.Stdout, friends)
18+
if err != nil {
19+
fmt.Println("There was an error executing template", err)
20+
}
21+
}

000_temp/04_tcp-sample/main.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package main
2+
3+
import (
4+
"bufio"
5+
"fmt"
6+
"net"
7+
)
8+
9+
func main() {
10+
conn, err := net.Dial("tcp", "golang.org:80")
11+
if err != nil {
12+
// handle error
13+
}
14+
15+
fmt.Fprintf(conn, "GET / HTTP/1.0\r\n\r\n")
16+
status, err := bufio.NewReader(conn).ReadString('\n')
17+
fmt.Println(status)
18+
}

000_temp/05_tcp-sample/main.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package main
2+
3+
import (
4+
"io"
5+
"log"
6+
"net"
7+
)
8+
9+
func main() {
10+
// Listen on TCP port 2000 on all interfaces.
11+
l, err := net.Listen("tcp", ":2000")
12+
if err != nil {
13+
log.Fatal(err)
14+
}
15+
defer l.Close()
16+
for {
17+
// Wait for a connection.
18+
conn, err := l.Accept()
19+
if err != nil {
20+
log.Fatal(err)
21+
}
22+
// Handle the connection in a new goroutine.
23+
// The loop then returns to accepting, so that
24+
// multiple connections may be served concurrently.
25+
go func(c net.Conn) {
26+
// Echo all incoming data.
27+
io.Copy(c, c)
28+
// Shut down the connection.
29+
c.Close()
30+
}(conn)
31+
}
32+
}

000_temp/06_html/index.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<style>
7+
/*div + h1 {color: red;} !*SIBLING first following*!*/
8+
/*div ~ h2 {color: orange;} !*SIBLING all following*!*/
9+
/*div > h2 {color: deeppink;} !*CHILDREN first level*!*/
10+
/*div h2 {color: deeppink;} !*CHILDREN all levels*!*/
11+
</style>
12+
</head>
13+
<body>
14+
<h1>h1 before div</h1>
15+
<h2>h2 before div</h2>
16+
<div>
17+
<h2>before</h2>
18+
<main><h2>h2 in main</h2></main>
19+
<p>01</p>
20+
<p>02</p>
21+
<p>03</p>
22+
<h2>after</h2>
23+
<h2>after after</h2>
24+
<h2 id="test">after after after</h2>
25+
</div>
26+
<h1>h1 after div</h1>
27+
<h1>h1 after div</h1>
28+
<h2>h2 after div</h2>
29+
<h2>h2 after div</h2>
30+
<h2>h2 after div</h2>
31+
</body>
32+
</html>

000_temp/07_time/main.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"time"
6+
)
7+
8+
func main() {
9+
t1 := time.Now()
10+
//fmt.Println(t1)
11+
fmt.Println(t1.Format("03:04"))
12+
//fmt.Println(t1.Format("01 02 2006 03:04"))
13+
//fmt.Println(t1.Format("01 02 2006 15:04"))
14+
15+
t2 := time.Now().Add(2 * time.Minute)
16+
fmt.Println(t2.Format("03:04"))
17+
18+
fmt.Println(t1.Before(t2))
19+
}

000_temp/08_flexbox/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<link rel="stylesheet" href="main.css">
7+
</head>
8+
<body>
9+
10+
<div class="container">
11+
<p>001</p><p>002</p><p>003</p><p>004</p><p>005</p><p>006</p><p>007</p><p>008</p><p>009</p><p>010</p><p>011</p><p>
12+
012</p><p>013</p><p>014</p><p>015</p><p>016</p><p>017</p><p>018</p><p>019</p><p>020</p>
13+
</div>
14+
15+
</body>
16+
</html>

000_temp/08_flexbox/main.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.container {
2+
display: flex;
3+
flex-flow: row wrap;
4+
}
5+
6+
p {
7+
border: 2px solid hotpink;
8+
}

000_temp/09_child/index.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
<link rel="stylesheet" href="main.css">
7+
</head>
8+
<body>
9+
<ul>
10+
<li>01</li>
11+
<li>02</li>
12+
<li>03</li>
13+
<li>04</li>
14+
<li>05</li>
15+
<li>06</li>
16+
<li>07</li>
17+
<li>08</li>
18+
<li>09</li>
19+
<li>10</li>
20+
<li>11</li>
21+
<li>12</li>
22+
<li>13</li>
23+
<li>14</li>
24+
<li>15</li>
25+
<li>16</li>
26+
<li>17</li>
27+
<li>18</li>
28+
<li>19</li>
29+
<li>20</li>
30+
</ul>
31+
</body>
32+
</html>

000_temp/09_child/main.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
li:first-child {
2+
color: red;
3+
}
4+
5+
li:nth-child(2) {
6+
color: yellow;
7+
background-color: blue;
8+
}

000_temp/10_review-tcp/01/main.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package main
2+
3+
import (
4+
"io"
5+
"log"
6+
"net"
7+
)
8+
9+
func main() {
10+
li, err := net.Listen("tcp", ":8080")
11+
if err != nil {
12+
log.Fatalln(err)
13+
}
14+
defer li.Close()
15+
16+
for {
17+
conn, err := li.Accept()
18+
if err != nil {
19+
log.Fatalln(err)
20+
}
21+
io.WriteString(conn, "DID IT WORK?")
22+
conn.Close()
23+
}
24+
}

000_temp/10_review-tcp/02/main.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"io"
6+
"io/ioutil"
7+
"log"
8+
"net"
9+
)
10+
11+
func main() {
12+
ln, err := net.Listen("tcp", ":8080")
13+
if err != nil {
14+
log.Fatalln(err)
15+
}
16+
defer ln.Close()
17+
18+
for {
19+
c, err := ln.Accept()
20+
if err != nil {
21+
log.Fatalln(err)
22+
}
23+
24+
bs, err := ioutil.ReadAll(c)
25+
if err != nil {
26+
log.Fatalln(err)
27+
}
28+
fmt.Println(string(bs))
29+
30+
io.WriteString(c, "hello")
31+
c.Close()
32+
}
33+
}

000_temp/10_review-tcp/03/main.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package main
2+
3+
import (
4+
"bufio"
5+
"fmt"
6+
"io"
7+
"log"
8+
"net"
9+
)
10+
11+
func main() {
12+
ln, err := net.Listen("tcp", ":8080")
13+
if err != nil {
14+
log.Fatalln(err)
15+
}
16+
defer ln.Close()
17+
18+
for {
19+
c, err := ln.Accept()
20+
if err != nil {
21+
log.Fatalln(err)
22+
}
23+
24+
scanner := bufio.NewScanner(c)
25+
for scanner.Scan() {
26+
ln := scanner.Text()
27+
fmt.Println(ln)
28+
if ln == "" {
29+
break
30+
}
31+
}
32+
33+
io.WriteString(c, "hello")
34+
c.Close()
35+
}
36+
}

0 commit comments

Comments
 (0)