diff options
author | austingebauer <gebauer.austin@gmail.com> | 2019-06-25 06:02:18 +0300 |
---|---|---|
committer | austingebauer <gebauer.austin@gmail.com> | 2019-06-25 06:02:18 +0300 |
commit | f76645130a6ac118027cc8ae7008d2fa682ddf22 (patch) | |
tree | 752084403b473d82a8dc25138aaa0cda5fc2453f | |
parent | d66bbd693587da48b18c50e6e56e231b6501817d (diff) |
feat: update styles and templates
-rw-r--r-- | content/posts/grpc_gateway.md | 96 | ||||
-rw-r--r-- | content/posts/ray-tracing.md | 89 | ||||
m--------- | public | 0 | ||||
-rw-r--r-- | themes/ag/layouts/_default/single.html | 27 | ||||
-rw-r--r-- | themes/ag/layouts/posts/list.html | 14 | ||||
-rw-r--r-- | themes/ag/layouts/posts/single.html | 23 | ||||
-rw-r--r-- | themes/ag/static/css/custom.scss | 9 | ||||
-rw-r--r-- | themes/ag/static/css/theme.css | 8 |
8 files changed, 126 insertions, 140 deletions
diff --git a/content/posts/grpc_gateway.md b/content/posts/grpc_gateway.md deleted file mode 100644 index 689d497..0000000 --- a/content/posts/grpc_gateway.md +++ /dev/null @@ -1,96 +0,0 @@ ---- -title: "Using gRPC Gateway with Protocol Buffers" -date: 2018-01-20T16:54:29-04:00 -draft: false -tags: ["grpc", "protobuf", "golang"] -categories: ["Software"] ---- - -- list -- of -- things - -1. list -2. of -3. ordered -4. things - -```go -// package tuple -package tuple - -import ( - "errors" - "log" - - "github.com/austingebauer/go-ray-tracer/math" -) - -const ( - vector float64 = 0.0 - point float64 = 1.0 -) - -// tuple represents a point or a vector in a left-handed coordinate system -type tuple struct { - // x, y, and z represent components in a left-handed coordinate system - x, y, z float64 - - // w indicates whether this tuple represents a point or a vector - // If the value of w is 0.0, then it represents a vector - // If the value of w is 1.0, then it represents a point - w float64 -} - -// NewPoint returns a new tuple that has the passed x, y, and z values. -func NewPoint(x, y, z float64) *tuple { - tpl, err := newTuple(x, y, z, point) - if err != nil { - log.Fatal(err) - } - return tpl -} - -// NewVector returns a new tuple that has the passed x, y, and z values. -func NewVector(x, y, z float64) *tuple { - tpl, err := newTuple(x, y, z, vector) - if err != nil { - log.Fatal(err) - } - return tpl -} - -// Equals returns true if the passed tuple is equal to this tuple. -// Two Tuples are equal if their x, y, z, and w members are equal. -func Equals(tpl1, tpl2 *tuple) bool { - return math.Float64Equals(tpl1.x, tpl2.x, math.Epsilon) && - math.Float64Equals(tpl1.y, tpl2.y, math.Epsilon) && - math.Float64Equals(tpl1.z, tpl2.z, math.Epsilon) && - math.Float64Equals(tpl1.w, tpl2.w, math.Epsilon) -} - -// Add creates and returns a new tuple by adding the corresponding components of each of the passed Tuples. -func Add(tpl1, tpl2 *tuple) (*tuple, error) { - if tpl1.w+tpl2.w == (point + point) { - return nil, errors.New("error: cannot add two point tuples") - } - - return newTuple(tpl1.x+tpl2.x, tpl1.y+tpl2.y, tpl1.z+tpl2.z, tpl1.w+tpl2.w) -} - -// newTuple returns a new tuple that has the passed x, y, z, and w values. -// This function is private in order to make the public interface for -// a tuple explicitly a point or a vector. -func newTuple(x, y, z, w float64) (*tuple, error) { - if w != vector && w != point { - return nil, errors.New("error: w must be either 0.0 or 1.0") - } - - return &tuple{ - x: x, - y: y, - z: z, - w: w, - }, nil -} -``` diff --git a/content/posts/ray-tracing.md b/content/posts/ray-tracing.md index 4d032df..f05880f 100644 --- a/content/posts/ray-tracing.md +++ b/content/posts/ray-tracing.md @@ -8,6 +8,95 @@ categories: ["Software", "Graphics"] This is a sample post that is written in markdown. +- list +- of +- things + +1. list +2. of +3. ordered +4. things + +```go +// package tuple +package tuple + +import ( + "errors" + "log" + + "github.com/austingebauer/go-ray-tracer/math" +) + +const ( + vector float64 = 0.0 + point float64 = 1.0 +) + +// tuple represents a point or a vector in a left-handed coordinate system +type tuple struct { + // x, y, and z represent components in a left-handed coordinate system + x, y, z float64 + + // w indicates whether this tuple represents a point or a vector + // If the value of w is 0.0, then it represents a vector + // If the value of w is 1.0, then it represents a point + w float64 +} + +// NewPoint returns a new tuple that has the passed x, y, and z values. +func NewPoint(x, y, z float64) *tuple { + tpl, err := newTuple(x, y, z, point) + if err != nil { + log.Fatal(err) + } + return tpl +} + +// NewVector returns a new tuple that has the passed x, y, and z values. +func NewVector(x, y, z float64) *tuple { + tpl, err := newTuple(x, y, z, vector) + if err != nil { + log.Fatal(err) + } + return tpl +} + +// Equals returns true if the passed tuple is equal to this tuple. +// Two Tuples are equal if their x, y, z, and w members are equal. +func Equals(tpl1, tpl2 *tuple) bool { + return math.Float64Equals(tpl1.x, tpl2.x, math.Epsilon) && + math.Float64Equals(tpl1.y, tpl2.y, math.Epsilon) && + math.Float64Equals(tpl1.z, tpl2.z, math.Epsilon) && + math.Float64Equals(tpl1.w, tpl2.w, math.Epsilon) +} + +// Add creates and returns a new tuple by adding the corresponding components of each of the passed Tuples. +func Add(tpl1, tpl2 *tuple) (*tuple, error) { + if tpl1.w+tpl2.w == (point + point) { + return nil, errors.New("error: cannot add two point tuples") + } + + return newTuple(tpl1.x+tpl2.x, tpl1.y+tpl2.y, tpl1.z+tpl2.z, tpl1.w+tpl2.w) +} + +// newTuple returns a new tuple that has the passed x, y, z, and w values. +// This function is private in order to make the public interface for +// a tuple explicitly a point or a vector. +func newTuple(x, y, z, w float64) (*tuple, error) { + if w != vector && w != point { + return nil, errors.New("error: w must be either 0.0 or 1.0") + } + + return &tuple{ + x: x, + y: y, + z: z, + w: w, + }, nil +} +``` + $$ i\hbar\frac{\partial}{\partial t} \Psi(\mathbf{r},t) = \left [ \frac{-\hbar^2}{2\mu}\nabla^2 + V(\mathbf{r},t)\right ] \Psi(\mathbf{r},t) $$ diff --git a/public b/public -Subproject 238f71b9c73ea3078ff281221ba1480f3b2057c +Subproject 26f42a12a59b20060a2aac81113dde84b829fd7 diff --git a/themes/ag/layouts/_default/single.html b/themes/ag/layouts/_default/single.html index ce29788..2527f3a 100644 --- a/themes/ag/layouts/_default/single.html +++ b/themes/ag/layouts/_default/single.html @@ -1,34 +1,7 @@ {{ define "main" }} <div class="container"> - <div> - <h1>{{ .Title | markdownify }}</h1> - {{ if .Params.Subtitle }} - <h2>{{ .Params.Subtitle | markdownify }}</h2> - {{ end }} - - <p> - <a href="{{ .Permalink }}">Published {{ .Date.Format "January 2, 2006" }}</a> - {{ range .Params.tags }} - <a href="{{ "/tags/" | relURL }}{{ . | urlize }}">#{{ . }}</a> - {{ end }} - </p> - <article> {{ .Content }} </article> </div> - - {{ if or .Next .Prev }} - <div> - {{ if .Prev }} - Previous: <a href="{{ .Prev.URL | relURL}}">{{ .Prev.Title | markdownify }}</a> - {{ end }} - </div> - <div> - {{ if .Next }} - Next: <a href="{{ .Next.URL | relURL }}">{{ .Next.Title | markdownify }}</a> - {{ end }} - </div> - {{ end }} - </div> {{ end }}
\ No newline at end of file diff --git a/themes/ag/layouts/posts/list.html b/themes/ag/layouts/posts/list.html new file mode 100644 index 0000000..6143136 --- /dev/null +++ b/themes/ag/layouts/posts/list.html @@ -0,0 +1,14 @@ +{{ define "main" }} + <div class="container"> + <ul> + {{ range .Pages }} + <li> + <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}"> + {{ .Date.Format "Jan 2, 2006" }} + </time> + <a href="{{ .URL | relURL }}">{{ if .Draft }}DRAFT: {{end}}{{ .Title }}</a> + </li> + {{ end }} + </ul> + </div> +{{ end }}
\ No newline at end of file diff --git a/themes/ag/layouts/posts/single.html b/themes/ag/layouts/posts/single.html new file mode 100644 index 0000000..88ce697 --- /dev/null +++ b/themes/ag/layouts/posts/single.html @@ -0,0 +1,23 @@ +{{ define "main" }} + <div class="container"> + <div class="row"> + <div class="col-12 col-sm-6 pb-2"> + <a href="{{ .Permalink }}">Published {{ .Date.Format "January 2, 2006" }}</a> + </div> + <div class="col-12 col-sm-6 pb-2"> + {{ range .Params.tags }} + <small><a href="{{ "/tags/" | relURL }}{{ . | urlize }}">#{{ . }}</a></small> + {{ end }} + </div> + </div> + + <h3>{{ .Title }}</h3> + {{ if .Params.Subtitle }} + <h5>{{ .Params.Subtitle }}</h5> + {{ end }} + + <article> + {{ .Content }} + </article> + </div> +{{ end }}
\ No newline at end of file diff --git a/themes/ag/static/css/custom.scss b/themes/ag/static/css/custom.scss index 5d1cd36..a7d66c5 100644 --- a/themes/ag/static/css/custom.scss +++ b/themes/ag/static/css/custom.scss @@ -44,15 +44,6 @@ $fa-font-path: "./webfonts"; background-color: $body-color; } -.category::before { - content: ""; - background-color: $body-color; - position: relative; - width: 10px; - height: 10px; - left: -40px; -} - hr { border: 0; height: 1px; diff --git a/themes/ag/static/css/theme.css b/themes/ag/static/css/theme.css index 7b5af2a..3283300 100644 --- a/themes/ag/static/css/theme.css +++ b/themes/ag/static/css/theme.css @@ -11361,14 +11361,6 @@ readers do not read off random characters that represent icons */ color: #f8f9fa; background-color: #333333; } -.category::before { - content: ""; - background-color: #333333; - position: relative; - width: 10px; - height: 10px; - left: -40px; } - hr { border: 0; height: 1px; |