Skip to content

Instantly share code, notes, and snippets.

@mikeananev
Created July 10, 2022 22:43
Show Gist options
  • Save mikeananev/46074e50180339bd4478edaaea178877 to your computer and use it in GitHub Desktop.
Save mikeananev/46074e50180339bd4478edaaea178877 to your computer and use it in GitHub Desktop.
presentation template
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{:min-bb-version "0.4.0"
:tasks
{:requires ([babashka.fs :as fs]
[babashka.process :refer [process check]]
[clojure.string :as str])
;; helpers and constants
:init
(do
(def ansi-green "\u001B[32m")
(def ansi-reset "\u001B[0m")
(def ansi-yellow "\u001B[33m")
(def date-formatter (java.time.format.DateTimeFormatter/ofPattern "yyyy-MM-dd HH:mm:ss"))
(defn current-timestamp [] (System/currentTimeMillis))
(defn current-date [t] (.format
(java.time.LocalDateTime/ofInstant
(java.time.Instant/ofEpochMilli t)
(java.time.ZoneId/systemDefault))
date-formatter))
(defn prf [& args] (println (apply format args)))
(def debug-exec? false)
(defn exec
"Execute command and put its output to a string"
[cmd]
(when debug-exec?
(prf "Execute command: '%s'" cmd))
(-> (process cmd {:out :string}) check :out str/trim-newline))
(defn safe-exec
"Execute command ignoring bad exit codes and put its output to a string if success. Returns nil if error."
([cmd] (safe-exec cmd true))
([cmd print-errors?]
(try (exec cmd)
(catch Exception e
(when print-errors?
(prf "command failed: '%s', error message: '%s'" cmd (.getMessage e)))))))
(def target-folder "target")
(def release-branches #{"master"})
(def deployable-branches #{"master" "develop"})
(def asciidoc-filename "index.adoc")
(def pdf-output-filename (str/replace (fs/file-name asciidoc-filename) (fs/extension asciidoc-filename) "pdf"))
(def html-output-filename (str/replace (fs/file-name asciidoc-filename) (fs/extension asciidoc-filename) "html"))
(defn get-project-env []
(let [git-branch (safe-exec "git rev-parse --abbrev-ref HEAD" false)
release? (contains? release-branches git-branch)
snapshot? (not release?)
t (current-timestamp)]
{:asciidoc-filename asciidoc-filename
:target-folder target-folder
:release-branches release-branches
:deployable-branches deployable-branches
:build-time (current-date t)
:build-timestamp t
:git-url (safe-exec "git config --get remote.origin.url" false)
:git-branch git-branch
:git-sha (safe-exec "git rev-parse --short HEAD" false)
:git-rev-count (safe-exec "git rev-list HEAD --count" false)
:release? release?
:snapshot? (not release?)
:deployable? (contains? deployable-branches git-branch)})))
:enter (let [{:keys [name]} (current-task)] (prf "%s[ ] %s %s%s" ansi-yellow name (current-date (current-timestamp)) ansi-reset))
:leave (let [{:keys [name]} (current-task)] (prf "%s[✔]︎ %s %s%s" ansi-green name (current-date (current-timestamp)) ansi-reset))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; commands
clean {:doc "Clean target folder"
:task (do (fs/delete-tree target-folder)
(fs/create-dir target-folder))}
build {:doc "Build HTML presentation"
:task (do
(fs/copy-tree "img" (format "%s/img" target-folder) {:replace-existing true :copy-attributes true :nofollow-links true})
(fs/copy-tree "css" (format "%s/css" target-folder) {:replace-existing true :copy-attributes true :nofollow-links true})
(fs/copy-tree "themes" (format "%s/themes" target-folder) {:replace-existing true :copy-attributes true :nofollow-links true})
(shell {:extra-env (get-project-env)} (format "asciidoctor-revealjs -D %s %s" target-folder asciidoc-filename))
(prf "Created HTML presentation: %s/%s" target-folder html-output-filename))}
pdf {:doc "Build PDF presentation"
:task (do
(shell {:extra-env (get-project-env)} (format "decktape -s 1900x1187 reveal %s/%s?fragments=true %s/%s" target-folder html-output-filename target-folder pdf-output-filename))
(prf "Created PDF presentation: %s/%s" target-folder pdf-output-filename))}
}}
p {
font-family: serif;
}
.reveal section h1 {
font-size: 1.9em;
font-family: serif;
}
.reveal section h2 {
display: inline-block;
font-size: 1.2em;
line-height: 1.2em;
vertical-align: top;
font-family: serif;
}
.small-green-text {
font-size: 0.44em;
color: #00bf00;
}
section.red.background {
background-color: red;
}
@import 'https://fonts.googleapis.com/css?family=Baloo+Bhai';
section[data-state="topic"] h2 {
font-family: 'Baloo Bhai', cursive;
font-size: 2em;
}
table.small-text {
font-size: 0.44em;
}
p.red-bg {
background-color: #fa0000;
}
table.some-size tr td {
font-size: 13px;
}
/*!
Theme: GitHub
Description: Light theme as seen on github.com
Author: github.com
Maintainer: @Hirse
Updated: 2021-05-15
Outdated base version: https://github.com/primer/github-syntax-light
Current colors taken from GitHub's CSS
*/
.hljs {
color: #24292e;
background: #ffffff;
}
.hljs-doctag,
.hljs-keyword,
.hljs-meta .hljs-keyword,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type,
.hljs-variable.language_ {
/* prettylights-syntax-keyword */
color: #d73a49;
}
.hljs-title,
.hljs-title.class_,
.hljs-title.class_.inherited__,
.hljs-title.function_ {
/* prettylights-syntax-entity */
color: #6f42c1;
}
.hljs-attr,
.hljs-attribute,
.hljs-literal,
.hljs-meta,
.hljs-number,
.hljs-operator,
.hljs-variable,
.hljs-selector-attr,
.hljs-selector-class,
.hljs-selector-id {
/* prettylights-syntax-constant */
color: #005cc5;
}
.hljs-regexp,
.hljs-string,
.hljs-meta .hljs-string {
/* prettylights-syntax-string */
color: #032f62;
}
.hljs-built_in,
.hljs-symbol {
/* prettylights-syntax-variable */
color: #e36209;
}
.hljs-comment,
.hljs-code,
.hljs-formula {
/* prettylights-syntax-comment */
color: #6a737d;
}
.hljs-name,
.hljs-quote,
.hljs-selector-tag,
.hljs-selector-pseudo {
/* prettylights-syntax-entity-tag */
color: #22863a;
}
.hljs-subst {
/* prettylights-syntax-storage-modifier-import */
color: #24292e;
}
.hljs-section {
/* prettylights-syntax-markup-heading */
color: #005cc5;
font-weight: bold;
}
.hljs-bullet {
/* prettylights-syntax-markup-list */
color: #735c0f;
}
.hljs-emphasis {
/* prettylights-syntax-markup-italic */
color: #24292e;
font-style: italic;
}
.hljs-strong {
/* prettylights-syntax-markup-bold */
color: #24292e;
font-weight: bold;
}
.hljs-addition {
/* prettylights-syntax-markup-inserted */
color: #22863a;
background-color: #f0fff4;
}
.hljs-deletion {
/* prettylights-syntax-markup-deleted */
color: #b31d28;
background-color: #ffeef0;
}
.hljs-char.escape_,
.hljs-link,
.hljs-params,
.hljs-property,
.hljs-punctuation,
.hljs-tag {
/* purposely ignored */
}

Тема презентации


background

Имя Фамилия [email protected]

Список

background
  • раз

  • два два

  • три три три

Список по левому краю

background
  • раз

  • два два

  • три три три

Пошаговый Список

background
  • раз

  • два два

  • три три три

Hard drive

Permanent storage for operating system and/or user files.

RAM

Temporarily stores information the CPU uses during operation.

Исходный код

background
(let [a 1
      b 2
      c (atom 42)]
  (+ a d @c))

Подсветка и нумерация строк

(defn safe-exec
      "Execute command ignoring bad exit codes and put its output to a string if success. Returns nil if error."
      ([cmd] (safe-exec cmd true))
      ([cmd print-errors?]
       (try (exec cmd)
            (catch Exception e
              (when print-errors?
                (prf "command failed: '%s', error message: '%s'" cmd (.getMessage e)))))))

Текст

background

Это просто текст.

Он предназначен для передачи деталей.

Я зеленый.

Слева.

Центр.

Справа.

Видео

Видосик в как фон и замьючен

Картинка

Clojure

Картинка как фон

background

Картинка maximized

Nature

Картинка без заголовка

background

Картинка фоном без заголовка

Колонки

  • Edgar Allen Poe

  • Sheri S. Tepper

  • Bill Bryson

Edgar Allan Poe (/poʊ/; born Edgar Poe; January 19, 1809 – October 7, 1849) was an American writer, editor, and literary critic.

  • 1

  • 2

  • 3

Цвет фона

Тут все должно быть красным

Цвет фона другой способ

Is very yellow

Динамическое изменение стиля H2

Тут текст слайда.

Табличка

Header 1 Header 2 Header 3

Column 1, row 1

Column 2, row 1

Column 3, row 1

Column 1, row 2

Column 2, row 2

Column 3, row 2

Column 1, row 3

Column 2, row 3

Column 3, row 3

Можно играть с шириной таблицы

Header 1 Header 2 Header 3

Column 1, row 1

Column 2, row 1

Column 3, row 1

Еще таблица

Artist Track Genre

Baauer

Harlem Shake

Hip Hop

The Lumineers

Ho Hey

Folk Rock


Artist

Track

Genre

Baauer

Harlem Shake

Hip Hop

The Lumineers

Ho Hey

Folk Rock

Формула

\$sqrt(4) = 2\$

Another one:

\$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}\$

Схема PlantUML

@startuml
scale 1.0
left to right direction

component A
component B
component C

A ---> B
A ---> C

@enduml
abc

Иконки

[twitter] [circle] [building] [battery 2] [globe] [envelope] [spinner] [address card]

Introduction[1]

This is some text.[1]

Footnotes[2][3]

A statement.[2]

Table

KSIA
  • William Bejeck,
    “Kafka Streams in Action”, November 2018

  • Примеры кода для Kafka 1.0


1. A footnote on introduction?!
2. A footnote on footnotes?!
3. Another one!
1. An example footnote.
2. Some text.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment