From: Charles McGarvey Date: Thu, 14 Jun 2018 03:52:46 +0000 (-0600) Subject: initial commit X-Git-Url: https://git.brokenzipper.com/gitweb?p=chaz%2Ftalk-event-driven-programming-in-perl;a=commitdiff_plain;h=7040bda8e2a0f1d9bb072f484f52a6148061777f initial commit --- 7040bda8e2a0f1d9bb072f484f52a6148061777f diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5429412 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/remark.min.js +/slides-offline.html diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..272b370 --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ + +SLIDES = event-driven-programming-in-perl +BROWSER = google-chrome +DOT = dot + +dotfiles = $(shell find . -iname '*.dot') +svgfiles = $(patsubst %.dot,%.svg,$(dotfiles)) + +all: offline + +clean: + rm -f slides-offline.html remark.min.js $(SLIDES).pdf $(svgfiles) + +offline: slides-offline.html remark.min.js $(svgfiles) + +pdf: $(SLIDES).pdf + +run: $(svgfiles) + $(BROWSER) slides.html + +run-offline: offline + $(BROWSER) slides-offline.html + +%.svg: %.dot + $(DOT) -Tsvg -o$@ $< + +$(SLIDES).pdf: slides.html $(wildcard css/*) $(wildcard img/*) $(svgfiles) + docker run --rm -v `pwd`:/pwd astefanutti/decktape /pwd/slides.html /pwd/$(SLIDES).pdf + +slides-offline.html: slides.html + sed -e '1 a ' \ + -e 's!https://.*remark-latest\.min\.js!remark.min.js!' <$< >$@ + +remark.min.js: + curl -Lo $@ https://gnab.github.io/remark/downloads/remark-latest.min.js + +.PHONY: all clean offline pdf run run-offline + diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b56498 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ + +# Slides for "Event-driven Programming in Perl" + +This directory contains the slides for my talk entitled "Event-driven Programming in Perl". + +The slides were written in [Markdown](https://daringfireball.net/projects/markdown/) format and can be rendered with +[remark](http://remarkjs.com/). + +## Options + +To view the slides: + + make run + +To build a PDF version of the slides: + + make pdf + diff --git a/abstract.txt b/abstract.txt new file mode 100644 index 0000000..f106536 --- /dev/null +++ b/abstract.txt @@ -0,0 +1,22 @@ +Event-driven programming in Perl +Charles McGarvey | Mon, 6/18 at 2:00 pm | 50 minutes | Ballroom B + +Event-driven programming is a paradigm where programmers creates subroutines +that get called when events occur. Events can be just about anything: timers +expiring, new data becoming available to read from a socket, even humans +clicking on things in an interactive program. + +Event-driven programming definitely isn't anything new, but there have been +some interesting developments over the past ten years. Event-driven frameworks +and applications have risen in popularity and are replacing systems built +using outdated techniques. New methods and language features have been created +to make event-driven programming nicer. + +In this talk we’ll go over: + + - the language features in Perl that make event-driven programming happen, + - some CPAN modules that offer the extra functionality you need. + +This talk is somewhat geared toward beginners (either to Perl or to +event-driven programming), but it may also be interesting to anyone wondering +about the current state of event-driven programming in Perl. diff --git a/css/common.css b/css/common.css new file mode 100644 index 0000000..5fe4e74 --- /dev/null +++ b/css/common.css @@ -0,0 +1,93 @@ +@import url(https://fonts.googleapis.com/css?family=Open+Sans); +@import url(https://fonts.googleapis.com/css?family=Muli); +@import url(https://fonts.googleapis.com/css?family=Inconsolata); + +.remark-slide-content { + font-family: 'Open Sans'; + font-size: 22px; +} + +.remark-slide-content h1, +.remark-slide-content h2, +.remark-slide-content h3 { + font-family: Muli; + font-weight: bold; +} +.remark-slide-content h2 { + font-size: 40px; +} +.remark-slide-content h3 { + font-size: 30px; +} + +.remark-slide-content li { + line-height: 2em; +} +.remark-slide-content .condensed li { + line-height: 1em; +} + +.remark-code, .remark-inline-code { + font-family: Inconsolata, monospace; +} +.remark-code { + border-radius: 5px; + border: 1px solid #ccc; +} + +.remark-slide-content blockquote { + border-radius: 5px; + border: 1px solid #ccc; + background: #f0f0f0; + margin: 1.5em 0; + padding: 1em; + quotes: "\201C""\201D""\2018""\2019"; + position: relative; +} +.remark-slide-content blockquote:before { + color: #ccc; + position: absolute; + content: open-quote; + font-size: 6em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.remark-slide-content .col { + box-sizing: border-box; + display: block; + float: left; + border: 0; + margin: 0; + padding: 0; + width: 50%; +} +.remark-slide-content .col:nth-of-type(odd) { + padding: 0 1em 0 0; +} +.remark-slide-content .col:nth-of-type(even) { + padding: 0 0 0 1em; +} +.remark-slide-content .col.sep:nth-of-type(odd) { + border-right: 1px solid #ccc; +} +.remark-slide-content .col.sep:nth-of-type(even) { + border-left: 1px solid #ccc; +} + +/* fix non-collapsing margin */ +.remark-slide-content .marginfix h3, +.remark-slide-content .marginfix ul { + margin-top: 0; +} + +.remark-slide-content .top-right { + float: right; + margin: 50px 0 0 2em; +} + +.remark-slide-content .highlight { + color: #7d9726; +} + diff --git a/css/slides.css b/css/slides.css new file mode 100644 index 0000000..04d938b --- /dev/null +++ b/css/slides.css @@ -0,0 +1,5 @@ + +#slide-bluehost img { + width: 250px; +} + diff --git a/img/bluehost.png b/img/bluehost.png new file mode 100644 index 0000000..3a83180 Binary files /dev/null and b/img/bluehost.png differ diff --git a/js/common.js b/js/common.js new file mode 100644 index 0000000..3832adb --- /dev/null +++ b/js/common.js @@ -0,0 +1,55 @@ + +/* + * Create a shortcut on a number key to jump to a named slide. + * + * Using the hotkey on the target slide will go "back" to the slide that was active before jumping + * to the target slide. + * + * Example: Jump to the slide named "myslide" when the "1" key is pressed. + * createHotkey(1, 'myslide'); + */ +function createHotkey(key, slideName) { + var targetSlide = slideshow.getSlideByName(slideName); + var lastSlide = -1; + document.addEventListener('keydown', function(e) { + if (e.which === key + 48) { + var currentNum = slideshow.getCurrentSlideIndex() + 1; + var targetNum = targetSlide.getSlideIndex() + 1; + if (currentNum !== targetNum) { + lastSlide = currentNum; + slideshow.gotoSlide(targetNum); + } + else { + slideshow.gotoSlide(lastSlide); + } + } + }); +}; + +/* + * Set a hotkey "u" to navigate backwards in time. + * + * If you get on the wrong slide, this might be the easiest way to get back on track. This is what + * you might expect the browser's "Back" button to do if it worked. + */ +(function() { + var history = []; + var skip = false; + slideshow.on('hideSlide', function(slide) { + if (skip) { + skip = false; + return; + } + history.push(slide.getSlideIndex() + 1); + }); + document.addEventListener('keydown', function(e) { + if (e.which === 85 /* [u]ndo */) { + var lastNum = history.pop(); + if (lastNum) { + skip = true; + slideshow.gotoSlide(lastNum); + } + } + }); +})(); + diff --git a/js/slides.js b/js/slides.js new file mode 100644 index 0000000..e69de29 diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..6841507 --- /dev/null +++ b/notes.txt @@ -0,0 +1,40 @@ + +Topics: + +Evolution of event-driven programming: +- Wait for a key press or line of text. +- Interrupts (hardware and software). +- Modern event loops + +How to write a modern event-loop. +- kernel facilities (poll, select, etc.) + +Event-drive programming in Perl +- POE +- AnyEvent +- IO::Async + +List of already-built event loops. +- EV +- Glib + +Types of events in modern applications: +- Data available +- Timer +- User input +- Signal +- Anything that can spontaneously happen in the real world. + +Exceptions in event-driven code. + +Promises: +- Future +- Future::AsyncAwait +- Future::Utils + +Real-world uses for event-driven applications: +- Webhooks +- WebSockets +- PubsubHubbub +- msg queue + diff --git a/slides.html b/slides.html new file mode 100644 index 0000000..46dbe40 --- /dev/null +++ b/slides.html @@ -0,0 +1,42 @@ + +Event-driven Programming in Perl +