Skip to content
This repository was archived by the owner on Sep 23, 2021. It is now read-only.

Favicon and cleanup #40

Merged
merged 3 commits into from
Mar 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
GIT_SUMMARY := $(shell git describe --tags --dirty --always)
REPO=msoedov/hacker-slides

DOCKER_IMAGE := $(REPO):$(GIT_SUMMARY)
default: repo

repo:
@echo $(REPO):$(GIT_SUMMARY)
@echo $(DOCKER_IMAGE)

build:
@GOOS=linux CGO_ENABLE=0 go build main.go
@docker build -t $(REPO):$(GIT_SUMMARY) .
@docker tag $(REPO):$(GIT_SUMMARY) $(REPO)
@docker build -t $(DOCKER_IMAGE) .
@docker tag $(DOCKER_IMAGE) $(REPO)

push:
@docker push $(REPO):$(GIT_SUMMARY)
@docker push $(DOCKER_IMAGE)
@docker push $(REPO)

r:
@docker run -it -p 8080:8080 $(REPO):$(GIT_SUMMARY)
@docker run -it -p 8080:8080 $(DOCKER_IMAGE)

release:
@build
@push
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func NewApp() *gin.Engine {
mustHaveSession := func(c *gin.Context) (string, error) {
session := sessions.Default(c)
val := session.Get("name")
emptySession := errors.New("Emtpy session")
emptySession := errors.New("Empty session")
if val == nil {
c.String(400, "No context")
return "", emptySession
Expand Down
12 changes: 6 additions & 6 deletions static/js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(function() {
$(function () {

function slideSeparatorLines(text) {
var lines = text.split('\n');
Expand All @@ -19,7 +19,7 @@ $(function() {
var text = ace.edit("editor").getValue();
var separatorPositions = slideSeparatorLines(text);
var slideNumber = separatorPositions.length;
separatorPositions.every(function(pos, num) {
separatorPositions.every(function (pos, num) {
if (pos >= cursorLine) {
slideNumber = num;
return false;
Expand All @@ -35,14 +35,14 @@ $(function() {
editor.getSession().setMode("ace/mode/markdown");
editor.getSession().setUseWrapMode(true);
editor.setShowPrintMargin(true);
$.get('/slides.md', function(data) {
$.get('/slides.md', function (data) {
editor.setValue(data, -1);
});
var lastSRow = -1;
ace.edit('editor').getSession().selection.on('changeCursor', function(e) {
ace.edit('editor').getSession().selection.on('changeCursor', function (e) {
var cursorRow = ace.edit('editor').getCursorPosition().row;
if(lastSRow === cursorRow){
return; // no update
if (lastSRow === cursorRow) {
return; // no update
}
lastSRow = cursorRow;
var currentSlide = currentCursorSlide(cursorRow);
Expand Down
4 changes: 2 additions & 2 deletions static/js/save.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
$(function() {
$(function () {
function reloadMarkdown() {
$('#slides-frame')[0].contentWindow.postMessage(JSON.stringify({
method: 'reloadMarkdown'
}), window.location.origin);
}

window.save = function() {
window.save = function () {
var editor = ace.edit("editor");

$.ajax("/slides.md", {
Expand Down
114 changes: 57 additions & 57 deletions static/js/slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,67 +17,67 @@ function initializeReveal() {

// Optional reveal.js plugins
dependencies: [{
src: '/static/reveal.js/lib/js/classList.js',
condition: function() {
return !document.body.classList;
}
},

// Interpret Markdown in <section> elements
{
src: '/static/reveal.js/plugin/markdown/marked.js',
condition: function() {
return !!document.querySelector('[data-markdown]');
}
}, {
src: '/static/reveal.js/plugin/markdown/markdown.js',
condition: function() {
return !!document.querySelector('[data-markdown]');
}
},

// Syntax highlight for <code> elements
{
src: '/static/reveal.js/plugin/highlight/highlight.js',
async: true,
callback: function() {
hljs.initHighlightingOnLoad();
}
},

// Zoom in and out with Alt+click
{
src: '/static/reveal.js/plugin/zoom-js/zoom.js',
async: true
},

// Speaker notes
{
src: '/static/reveal.js/plugin/notes/notes.js',
async: true
},

// MathJax
{
src: '/static/reveal.js/plugin/math/math.js',
async: true
},

{
src: '/static/reveal.js/lib/js/classList.js',
condition: function() {
return !document.body.classList;
}
src: '/static/reveal.js/lib/js/classList.js',
condition: function () {
return !document.body.classList;
}
},

// Interpret Markdown in <section> elements
{
src: '/static/reveal.js/plugin/markdown/marked.js',
condition: function () {
return !!document.querySelector('[data-markdown]');
}
}, {
src: '/static/reveal.js/plugin/markdown/markdown.js',
condition: function () {
return !!document.querySelector('[data-markdown]');
}
},

// Syntax highlight for <code> elements
{
src: '/static/reveal.js/plugin/highlight/highlight.js',
async: true,
callback: function () {
hljs.initHighlightingOnLoad();
}
},

// Zoom in and out with Alt+click
{
src: '/static/reveal.js/plugin/zoom-js/zoom.js',
async: true
},

// Speaker notes
{
src: '/static/reveal.js/plugin/notes/notes.js',
async: true
},

// MathJax
{
src: '/static/reveal.js/plugin/math/math.js',
async: true
},

{
src: '/static/reveal.js/lib/js/classList.js',
condition: function () {
return !document.body.classList;
}
}
]
});

themesCtrl();
}

function highlightAnyCodeBlocks() {
$(document).ready(function() {
$('pre code').each(function(i, block) {
$(document).ready(function () {
$('pre code').each(function (i, block) {
hljs.highlightBlock(block);
});
});
Expand Down Expand Up @@ -108,7 +108,7 @@ function reloadMarkdown() {
}

function externalLinksInNewWindow() {
$(document.links).filter(function() {
$(document.links).filter(function () {
return this.hostname != window.location.hostname;
}).attr('target', '_blank');
}
Expand All @@ -119,7 +119,7 @@ initializeReveal();
function themesCtrl() {
var defaultTheme = "black.css",
currentTheme = localStorage.getItem('theme?') ||
defaultTheme;
defaultTheme;

function setTheme(theme) {
cssEl = $("#theme");
Expand All @@ -145,12 +145,12 @@ function themesCtrl() {
"white.css",
];
themeEl = $("#themes");
availableThemes.forEach(function(theme) {
availableThemes.forEach(function (theme) {
elem = $("<option value=" + theme + ">" + theme + "</option>");
themeEl.append(elem);
})
themeEl.val(currentTheme);
themeEl.change(function() {
themeEl.change(function () {
val = themeEl.val()
setTheme(val);
});
Expand Down
1 change: 1 addition & 0 deletions templates/index.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<title>Hacker Slides</title>

<link rel="stylesheet" href="/static/css/index.css">
<link href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIsSURBVFhH7dg/SFVhGMfxg4FgJGVEGQSBBILYUAQl2NCftUkanKwhcmkQsq0iLIKiGiSwpQYDhSAadIlSl+aIpmzQzdwUTMToz/d3vQcuL885vnrP+16w+4MPeN7He9/nXj3nvOdN/oecxBUcLB1t5Dj6cKR0VMNcwx/8xQIuYhC/ymMrOIua5DBWoUbyzKMR0TMEqyFLL6JnDlYzlg+ImlOwGsmyjr2Ikla8gtVInlvYg2C5hGmkZ+12rGEMJ1BoXsOacLt0GdI3WkiaoU9uTVSN7ygsHXiMj/gGa8LN6Jr5FRO4A11Hg0WfXpM+wxN8KR+ndNZO4jamymOPEC03oUlflo6S5Bh+Im1Q33QTdGnRneQ39DvRshu670o7zlUcp05DCwn93IVCswtH0RbJIXhH347+mdM/Vyw6Cb1yBtYbhLYIr3TDeoPQluCVeoMZ6g1Wq95gtYI0qMXrfeh+69a0annnjOUJ0qCWXsow3NoFaJnmjmcJ0uAMlHG4tcs44IzlCdLgGyhaXrm1G1DSXYbNBGnwORRrcXEPirZE3JolSIN3oehG79ZeQPkMt2YJ0mA/GqAVs1t7C+U93JrFu8GtLLd6oG03q/YJyiisuusHvKJnCfchKIu21jqdsdQslKew6q6H8I7vkl/baudhTbgMZT+s11aq3PwsPAOwGhRNXpNoa1dbFyPI23XQLfABrkMnU7RchdVQFu0qbOnJrYjsQ4snPSnuxCTJP2DL0jFAlrNjAAAAAElFTkSuQmCC" rel="icon" type="image/x-icon">
</head>

<body>
Expand Down