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 sys, re | |
if sys.version_info.major != 3: | |
raise ValueError("You must use Python 3.") | |
if sys.version_info.minor < 4: | |
raise ValueError("You must use at least Python 3.4") | |
if sys.version_info.minor < 6: | |
print("Recommended Python Version is 3.6") | |
test_phone_numbers = [ |
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
{{define "base"}} | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<link rel="stylesheet" href="/static/css/style.css"> | |
<link rel="stylesheet" href="/static/css/normalize.css"> | |
<title>{{template "title" .}}</title> | |
</head> | |
<body> |
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
{{template "base" .}} | |
{{define "title"}} Posts List {{end}} | |
{{define "content"}} | |
{{range .posts}} | |
<div class="post_wrapper"> | |
<h2 class="title"> | |
<a href="/posts/{{.ID}}">{{.Title}}</a> | |
</h2> | |
<p class="date"> |
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
{{template "base" .}} | |
{{define "title"}} New Post {{end}} | |
{{ define "content"}} | |
{{range .posts}} | |
<div class="post_wrapper"> | |
<h2 class="title"> | |
<a href="/posts/{{.ID}}">{{.Title}}</a> | |
</h2> | |
<p class="date"> |
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 IndexController(c context.Context) { | |
var posts []Post | |
db.Order("created_at desc").Find(&posts) | |
ss := sess.Start(c) | |
auth := ss.Get("auth") | |
c.ViewData("posts", posts) | |
c.ViewData("auth", auth) | |
c.View("index.html") |
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" | |
) | |
type Square struct { | |
side float64 | |
} |
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
//calculator_test.go | |
package main | |
import "testing" | |
func TestAdd(t *testing.T) { | |
if result, _ := AddFunc(1,2); result != 3 { | |
t.Error("Test failed") | |
} | |
} |
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
//calculator.go | |
package main | |
import "errors" | |
func main() { | |
} | |
func AddFunc(num ...int) (int, error) { |
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
//calculator_test.go | |
package main | |
import "testing" | |
func TestAdd(t *testing.T) { | |
if result, _ := AddFunc(1,2); result != 3 { | |
t.Error("Test failed") | |
} | |
} |
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" | |
"time" | |
) | |
func main() { | |
countFruit("Apple") | |
countFruit("Orange") |
OlderNewer