Browse Source

Switch to reveal.js

Signed-off-by: Amelia Aronsohn <squirrel@wearing.black>
master
Amelia A 2 years ago
parent
commit
c9e2d90b87
Signed by: amy GPG Key ID: 98E879BC3B6E1BF8
  1. 3
      .gitmodules
  2. 52
      2020-template.html
  3. 258
      FavoriteProgrammingSerpents.html
  4. 257
      my-favorite-serpents.html
  5. 1
      reveal.js

3
.gitmodules

@ -0,0 +1,3 @@
[submodule "reveal.js"]
path = reveal.js
url = https://github.com/hakimel/reveal.js.git

52
2020-template.html

@ -0,0 +1,52 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>My Favorite Programming Serpents</title>
<link rel="stylesheet" href="reveal.js/css/reset.css">
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/black.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="reveal.js/lib/css/monokai.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>Slide 1</section>
<section>Slide 2</section>
</div>
</div>
<script src="reveal.js/js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
hash: true,
controls: false,
progress: true,
dependencies: [
{ src: 'reveal.js/plugin/markdown/marked.js' },
{ src: 'reveal.js/plugin/markdown/markdown.js' },
{ src: 'reveal.js/plugin/highlight/highlight.js' },
{ src: 'reveal.js/plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>

258
FavoriteProgrammingSerpents.html

@ -1,258 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>My Awesome Presentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700,400italic);
body { font-family: 'Droid Serif'; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Ubuntu Mono'; }
</style>
</head>
<body>
<textarea id="source">
class: center, middle
# My Favorite Programming Serpents
_That are not python_
---
class: center, middle
# A Golang talk
---
class: center, middle
# How do I Golang?
---
class: center, middle
# vim main.go
---
class: center, middle
## No wait but how do I make a maintanable Golang?
---
class: left, middle
- /Makefile
- /cli
- main.go
- /bin
- probably_important.go
- /server
- run_this.go
- /lib
- errors.go
- logging.go
- config.go
- config_butonlyforactualmain.go
---
class: center, middle
# UGH
---
class: center, middle
# An Alternitive
---
class: center, middle
# Cobra & Viper
---
class: center, middle
# Step 1: Cobra
---
class: center, middle
# cobra init .
---
class: left, middle
- main.go # Do not touch me
- cmd/
- root.go
- server.go
- cert.go
- lib/**
---
class: center, middle
# Where is my makefile?
---
class: center, middle
# go build .
---
class: left, middle
## One binary:
- redirector
## Many sub commands:
- redirector
- redirector server
- redirector cert
---
class: center, middle
# What about this configuration work?
---
class: center, middle
# Step 2: Viper
---
class: left, middle
## Who wants to parse & merge;
- Config file
- Flags
- Env
---
class: left, middle
```golang
// vim config.toml
viper.SetConfigName("config")
viper.AddConfigPath("/etc/app/")
viper.AddConfigPath(".")
viper.SetDefault("https_port", 8443)
err := viper.ReadInConfig()
port := viper.GetInt("https_port")
```
---
class: center, middle
# Wait you didn't tell viper it was a toml file
---
class: center, middle
# Viper will figure it out
---
class: center, middle
# What about my ENV?
---
class: left, middle
```golang
// export REDIRECTOR_HTTPS_PORT=443
viper.SetEnvPrefix("REDIRECTOR_")
viper.AutomaticEnv()
port := viper.GetInt("https_port")
```
---
class: center, middle
# And my command line flags?!
---
class: left, middle
```golang
// redirector --https 443
serverCmd.Flags().Int("https", 443, "Port to run https on")
viper.BindPFlag("https_port", serverCmd.Flags().Lookup("https"))
```
---
class: center, middle
So you are telling me these two will handle my application's structure, all my configuration management, and allow for well isolated components of my application to be run seperately?
--
# Yes
---
class: center, middle
# Questions?
---
class: center, middle
# Wait I have a question!
---
class: center, middle
# Do I have to use both?
--
# No way!
For very simple apps I only use viper
I have used Cobra without Viper once, but almost everything I write needs a config
---
class: center, middle
# Ok, but who uses stuff like this?
---
class: left, middle
- Kubernetes
- Hugo
- etcd
- Moby
- Docker
- OpenShift
- CockroachDB
- and more
From https://github.com/spf13/cobra
---
class: center, middle
# Any More Questions?
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js" type="text/javascript">
</script>
<script type="text/javascript">
var slideshow = remark.create({
highlightLanguage: 'golang',
highlightLines: true
});
</script>
</body>
</html>

257
my-favorite-serpents.html

@ -0,0 +1,257 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>My Favorite Programming Serpents</title>
<link rel="stylesheet" href="reveal.js/css/reset.css">
<link rel="stylesheet" href="reveal.js/css/reveal.css">
<link rel="stylesheet" href="reveal.js/css/theme/black.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="reveal.js/lib/css/monokai.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'reveal.js/css/print/pdf.css' : 'reveal.js/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<H3>My Favorite Programming Serpents</H3>
<p>
<em>that are not python</em>
</p>
</section>
<section>
A Golang talk
</section>
<section>
How <em>does</em> someone go?
</section>
<section>
$ vim main.go
</section>
<section>
<H3>No wait.</H3>
How do I <em>maintainably</em> go?
</section>
<section>
<ul>
<li>/Makefile</li>
<li>/cli</li>
<ul>
<li>main.go</li>
</ul>
<li>/bin</li>
<ul>
<li>probablyImportant.rb</li>
</ul>
<li>/server</li>
<ul>
<li>runThis.go</li>
</ul>
<li>/lib</li>
<ul>
<li>env.go</li>
<li>logging.go</li>
<li>config.go</li>
<li>configButOnlyForRunThis.go</li>
</ul>
</ul>
</section>
<section>
<H1>UGH</H1>
</section>
<section>
<H2>Cobra &amp; Viper</H2>
An Alternative Solution
</section>
<section>
<H2>Step 1: Cobra</H2>
<p class="fragment">
$ cobra init .
</p>
<ul class="fragment">
<li>main.go <span style="color: #808080"># Don't touch me</span></li>
<li>cmd/</li>
<ul>
<li>root.go</li>
<li>server.go</li>
<li>cert.go</li>
</ul>
<li>lib/**</li>
</ul>
</section>
<section>
<H3>One binary, Many Commands:</H3>
<ul>
<li>redirector</li>
<li>redirector server</li>
<li>redirector cert</li>
</ul>
</section>
<section>
<H3>Where is my Makefile?</H3>
<p class="fragment">
$ go build .
</p>
<p class="fragment">
<em>ok, maybe you still want one</em>
</p>
</section>
<section>
<H2>What about configuration?</H2>
</section>
<section>
Who wants to write code parse &amp; merge
<ol>
<li class="fragment">config files</li>
<li class="fragment">command line flags</li>
<li class="fragment">environment variables</li>
</ol>
</section>
<section>
<H2>Step 2: Viper</H2>
<pre>
<code class="golang" data-trim data-line-numbers="3,7,10">
// vim config.toml
viper.SetConfigName("config")
viper.AddConfigPath("/etc/app/")
viper.AddConfigPath(".")
viper.SetDefault("https_port", 8443)
err := viper.ReadInConfig()
port := viper.GetInt("https_port")
</code>
</pre>
</section>
<section>
Wait, you didn't tell Viper it is a toml
<pre>
<code class="hljs golang" data-trim>
// vim config.toml
viper.SetConfigName("config")
</code>
</pre>
<p class="fragment">
Viper automatically checks for all formats
</p>
<p class="fragment">
...and parses them appropiately
</p>
</section>
<section>
What about Environment Variables?
<pre>
<code class="hljs golang" data-trim>
// export REDIRECTOR_HTTPS_PORT=443
viper.SetEnvPrefix("REDIRECTOR_")
viper.AutomaticEnv()
port := viper.GetInt("https_port")
</code>
</pre>
</section>
<section>
And my command line flags!?
<pre>
<code class="hljs golang" data-trim>
// redirector --https 443
serverCmd.Flags().Int("https", 443, "Port to run https on")
viper.BindPFlag("https_port", serverCmd.Flags().Lookup("https"))
</code>
</pre>
</section>
<section>
<p>
So you are telling me these two will handle…
<span class="fragment">my application's structure, </span>
<span class="fragment">all my configuration management, </span>
<span class="fragment">and allow for well isolated components of my application to be run seperately?</span>
</p>
<H2 class="fragment">Yes</H2>
</section>
<section>
<H2>Questions?</H2>
<H3 class="fragment">Wait I have a question!</H3>
</section>
<section>
<H2>Do I have to use both?</H2>
<H3 class="fragment">No Way!</H3>
<p class="fragment">
On established simple apps I have replaced my config handling w/ viper
</p>
</section>
<section>
<H3>Ok, but who uses stuff like this?</H3>
<ul>
<li class="fragment">Kubernetes</li>
<li class="fragment">Hugo</li>
<li class="fragment">etcd</li>
<li class="fragment">Moby</li>
<li class="fragment">Docker</li>
<li class="fragment">OpenShift</li>
<li class="fragment">CockroachDB</li>
<li class="fragment">and more</li>
</ul>
</section>
<section>
<H1>Any More Questions?</H1>
</section>
</div>
</div>
<script src="reveal.js/js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
hash: true,
controls: false,
progress: true,
dependencies: [
{ src: 'reveal.js/plugin/markdown/marked.js' },
{ src: 'reveal.js/plugin/markdown/markdown.js' },
{ src: 'reveal.js/plugin/highlight/highlight.js' },
{ src: 'reveal.js/plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>

1
reveal.js

@ -0,0 +1 @@
Subproject commit 00b0ace3863952ce95df4430d203686fd27bfc20
Loading…
Cancel
Save