├── .DS_Store ├── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Makefile ├── README.markdown ├── Thorfile ├── compiled-lectures ├── 00-intro.pdf ├── 01-intro-to-python.pdf ├── 02-collections.pdf ├── 03-decorators.pdf ├── 04-oop.pdf ├── 05-home-work-discussions.pdf ├── 06-oop-2.pdf ├── 07-exceptions-and-with.pdf ├── 08-iterators-and-generators.pdf ├── 10-modules.pdf ├── 11-regex-and-environments.pdf ├── 12-meta-object-protocol.pdf ├── 13-metaprogramming.pdf ├── 14-django-1.pdf ├── 15-django-2.pdf ├── 16-c-python.pdf ├── 17-concurrency.pdf ├── 18-robotics.pdf ├── 19-numpy-and-pandas.pdf ├── 20-analysis-and-youtube-faces.pdf └── 21-pygame-and-stuff.pdf ├── html ├── css │ ├── pygments.css │ └── styles.css ├── images │ ├── captcha-challenge-accepted.png │ ├── rdoc-apidock.png │ ├── rdoc-default.png │ ├── rdoc-rails.png │ └── rdoc-yard.png ├── js │ ├── html5shim.js │ ├── htmlSlides.js │ ├── jquery-3.7.1.min.js │ └── jquery.jswipe-0.1.2.js └── layout.slim ├── lectures └── index.yml └── lib ├── slides.rb └── slides ├── annotate.rb ├── annotator.rb ├── builder.rb ├── code.rb ├── example.rb ├── lecture.rb ├── list.rb ├── slide_helper.rb └── text.rb /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | compiled-lectures 2 | .bundle 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'slim' 4 | gem 'thor' 5 | gem 'listen' 6 | gem 'pygments.rb' 7 | gem 'rcodetools' 8 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | ffi (1.15.5) 5 | listen (0.4.7) 6 | rb-fchange (~> 0.0.5) 7 | rb-fsevent (~> 0.9.1) 8 | rb-inotify (~> 0.8.8) 9 | pygments.rb (2.3.0) 10 | rb-fchange (0.0.5) 11 | ffi 12 | rb-fsevent (0.9.1) 13 | rb-inotify (0.8.8) 14 | ffi (>= 0.5.0) 15 | rcodetools (0.8.5.0) 16 | slim (1.0.3) 17 | temple (~> 0.3.4) 18 | tilt (~> 1.3.2) 19 | temple (0.3.4) 20 | thor (0.14.6) 21 | tilt (1.3.3) 22 | 23 | PLATFORMS 24 | ruby 25 | 26 | DEPENDENCIES 27 | listen 28 | pygments.rb 29 | rcodetools 30 | slim 31 | thor 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 ФМИ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # A Make file, that conforms with the web site's expectations. Running 'make' 2 | # has to create a directory called 'compiled-lectures' that will be linked by 3 | # the site's deploy process. 4 | all: 5 | bundle install 6 | bundle exec thor rebuild 7 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | ## Лекции към курса "Програмиране с Python" 2 | 3 | Лекции от [курса "Програмиране с Python"](http://fmi.py-bg.net). 4 | 5 | Презентациите се пишат на [Slim](http://slim-lang.com/) с няколко разширения, специфични за нашия начин на употреба. 6 | 7 | Съдържанието на презентациите се намира в папка `lectures/`. Всяка презентация се описва с няколко реда в `lectures/index.yml`. 8 | 9 | На база на данните в `lectures/`, се генерират статичните HTML-версии на презентациите, които след генерация живеят в папка `compiled/`. Те са крайният продукт, който се качва на [сайта на курса](http://fmi.py-bg.net). 10 | 11 | ## Инсталация 12 | 13 | - Клонирате хранилището някъде и сменате текущата си директория да е там 14 | - `sudo easy_install pygments` 15 | - `bundle install` 16 | - `bundle exec thor rebuild` 17 | 18 | ## Генериране на една лекция 19 | 20 | С командата `thor lecture ` може да прегенерирате лекция номер ``. Например, ако искате да прегенерирате презентация 8, това става със следната команда: 21 | 22 | bundle exec thor lecture 8 23 | 24 | Възможно е и да изпълните `thor watch`. Това ще стартира процес, който да стои и да слуша за промени по файловете в папката `lectures/` и ще прегенерира съответната лекция автоматично при промяна на който и да е от `.slim`source-файловете. 25 | 26 | ## Упътвания за принос 27 | 28 | За да допринесете по някакъв начин към тези материали, е необходимо първо да си подкарате локално генерацията на слайдовете, след това да генерирате HTML-версията на презентацията след промените и да я прегледате в браузър, за да се уверите, че промените изглеждат така, както сте очаквали. 29 | 30 | Препоръчително е да правите pull request-и в съответен branch, например `08-fix-typos` (за поправка на правописни грешки в презентация 8). 31 | -------------------------------------------------------------------------------- /Thorfile: -------------------------------------------------------------------------------- 1 | require './lib/slides' 2 | require 'listen' 3 | 4 | class Thor::Actions::CreateFile 5 | def force_on_collision? 6 | true 7 | end 8 | end 9 | 10 | class Default < Thor 11 | include Thor::Actions 12 | source_root File.dirname(__FILE__) 13 | 14 | desc 'rebuild', 'Rebuilds all presentations' 15 | def rebuild 16 | puts "Rebuilding lectures from #{Slides.lectures_path} (change it by setting PYTHON_LECTURES_PATH)" 17 | 18 | empty_directory Slides.compiled_lectures_path 19 | %w(js css images).each do |folder| 20 | directory "html/#{folder}", "#{Slides.compiled_lectures_path}/#{folder}" 21 | end 22 | copy_file "#{Slides.lectures_path}/index.yml", "#{Slides.compiled_lectures_path}/index.yml" 23 | 24 | slides.keys.each do |number| 25 | lecture number.to_s 26 | end 27 | end 28 | 29 | desc 'watch', 'Fires up an FS listener to rebuld presentations when the source file changes.' 30 | 31 | def watch 32 | puts "Listening for changes in #{Slides.lectures_path} (change it by setting PYTHON_LECTURES_PATH)" 33 | 34 | Listen.to(Slides.lectures_path) do |modified, added, removed| 35 | (modified + added + removed).grep(/(\d+)-[\w\-]+.slim$/) do 36 | begin 37 | lecture $1.to_i 38 | rescue Exception => e 39 | say_status :failed, "Failed to compile: #{e.class.name}", :red 40 | say e.message.gsub(/^/, " ") 41 | end 42 | end 43 | end 44 | end 45 | 46 | desc 'lecture', 'Rebuilds a single lecture' 47 | def lecture(index) 48 | index = '%02d' % index 49 | builder = builder_for(index) 50 | 51 | create_file "#{Slides.compiled_lectures_path}/#{builder.output_filename}", builder.html.force_encoding('BINARY') 52 | 53 | lecture_folder = "#{Slides.lectures_path}/#{index}" 54 | directory lecture_folder, "#{Slides.compiled_lectures_path}/#{index}" if File.directory?(lecture_folder) 55 | end 56 | 57 | no_tasks do 58 | def builder_for(index) 59 | builder_defaults = { 60 | lectures_path: Slides.lectures_path, 61 | templates_path: self.class.source_root, 62 | } 63 | 64 | Builder.new builder_defaults.merge(slides[index.to_i]) 65 | end 66 | 67 | def slides 68 | return @slides if @slides 69 | 70 | @slides = YAML.load_file "#{Slides.lectures_path}/index.yml" 71 | @slides.delete_if { |index, attributes| attributes.has_key? 'url' } 72 | 73 | @slides 74 | end 75 | end 76 | end 77 | -------------------------------------------------------------------------------- /compiled-lectures/00-intro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/00-intro.pdf -------------------------------------------------------------------------------- /compiled-lectures/01-intro-to-python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/01-intro-to-python.pdf -------------------------------------------------------------------------------- /compiled-lectures/02-collections.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/02-collections.pdf -------------------------------------------------------------------------------- /compiled-lectures/03-decorators.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/03-decorators.pdf -------------------------------------------------------------------------------- /compiled-lectures/04-oop.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/04-oop.pdf -------------------------------------------------------------------------------- /compiled-lectures/05-home-work-discussions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/05-home-work-discussions.pdf -------------------------------------------------------------------------------- /compiled-lectures/06-oop-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/06-oop-2.pdf -------------------------------------------------------------------------------- /compiled-lectures/07-exceptions-and-with.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/07-exceptions-and-with.pdf -------------------------------------------------------------------------------- /compiled-lectures/08-iterators-and-generators.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/08-iterators-and-generators.pdf -------------------------------------------------------------------------------- /compiled-lectures/10-modules.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/10-modules.pdf -------------------------------------------------------------------------------- /compiled-lectures/11-regex-and-environments.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/11-regex-and-environments.pdf -------------------------------------------------------------------------------- /compiled-lectures/12-meta-object-protocol.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/12-meta-object-protocol.pdf -------------------------------------------------------------------------------- /compiled-lectures/13-metaprogramming.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/13-metaprogramming.pdf -------------------------------------------------------------------------------- /compiled-lectures/14-django-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/14-django-1.pdf -------------------------------------------------------------------------------- /compiled-lectures/15-django-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/15-django-2.pdf -------------------------------------------------------------------------------- /compiled-lectures/16-c-python.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/16-c-python.pdf -------------------------------------------------------------------------------- /compiled-lectures/17-concurrency.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/17-concurrency.pdf -------------------------------------------------------------------------------- /compiled-lectures/18-robotics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/18-robotics.pdf -------------------------------------------------------------------------------- /compiled-lectures/19-numpy-and-pandas.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/19-numpy-and-pandas.pdf -------------------------------------------------------------------------------- /compiled-lectures/20-analysis-and-youtube-faces.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/20-analysis-and-youtube-faces.pdf -------------------------------------------------------------------------------- /compiled-lectures/21-pygame-and-stuff.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/compiled-lectures/21-pygame-and-stuff.pdf -------------------------------------------------------------------------------- /html/css/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight .c { color: #008800; font-style: italic } /* Comment */ 3 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 4 | .highlight .k { color: #AA22FF; font-weight: bold } /* Keyword */ 5 | .highlight .o { color: #666666 } /* Operator */ 6 | .highlight .cm { color: #008800; font-style: italic } /* Comment.Multiline */ 7 | .highlight .cp { color: #008800 } /* Comment.Preproc */ 8 | .highlight .c1 { color: #008800; font-style: italic } /* Comment.Single */ 9 | .highlight .cs { color: #008800; font-weight: bold } /* Comment.Special */ 10 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 11 | .highlight .ge { font-style: italic } /* Generic.Emph */ 12 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 13 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 14 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 15 | .highlight .go { color: #808080 } /* Generic.Output */ 16 | .highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ 17 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 18 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 19 | .highlight .gt { color: #0040D0 } /* Generic.Traceback */ 20 | .highlight .kc { color: #AA22FF; font-weight: bold } /* Keyword.Constant */ 21 | .highlight .kd { color: #AA22FF; font-weight: bold } /* Keyword.Declaration */ 22 | .highlight .kn { color: #AA22FF; font-weight: bold } /* Keyword.Namespace */ 23 | .highlight .kp { color: #AA22FF } /* Keyword.Pseudo */ 24 | .highlight .kr { color: #AA22FF; font-weight: bold } /* Keyword.Reserved */ 25 | .highlight .kt { color: #00BB00; font-weight: bold } /* Keyword.Type */ 26 | .highlight .m { color: #666666 } /* Literal.Number */ 27 | .highlight .s { color: #BB4444 } /* Literal.String */ 28 | .highlight .na { color: #BB4444 } /* Name.Attribute */ 29 | .highlight .nb { color: #AA22FF } /* Name.Builtin */ 30 | .highlight .nc { color: #0000FF } /* Name.Class */ 31 | .highlight .no { color: #880000 } /* Name.Constant */ 32 | .highlight .nd { color: #AA22FF } /* Name.Decorator */ 33 | .highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */ 34 | .highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ 35 | .highlight .nf { color: #00A000 } /* Name.Function */ 36 | .highlight .nl { color: #A0A000 } /* Name.Label */ 37 | .highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ 38 | .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ 39 | .highlight .nv { color: #B8860B } /* Name.Variable */ 40 | .highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ 41 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 42 | .highlight .mf { color: #666666 } /* Literal.Number.Float */ 43 | .highlight .mh { color: #666666 } /* Literal.Number.Hex */ 44 | .highlight .mi { color: #666666 } /* Literal.Number.Integer */ 45 | .highlight .mo { color: #666666 } /* Literal.Number.Oct */ 46 | .highlight .sb { color: #BB4444 } /* Literal.String.Backtick */ 47 | .highlight .sc { color: #BB4444 } /* Literal.String.Char */ 48 | .highlight .sd { color: #BB4444; font-style: italic } /* Literal.String.Doc */ 49 | .highlight .s2 { color: #BB4444 } /* Literal.String.Double */ 50 | .highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ 51 | .highlight .sh { color: #BB4444 } /* Literal.String.Heredoc */ 52 | .highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ 53 | .highlight .sx { color: #008000 } /* Literal.String.Other */ 54 | .highlight .sr { color: #BB6688 } /* Literal.String.Regex */ 55 | .highlight .s1 { color: #BB4444 } /* Literal.String.Single */ 56 | .highlight .ss { color: #B8860B } /* Literal.String.Symbol */ 57 | .highlight .bp { color: #AA22FF } /* Name.Builtin.Pseudo */ 58 | .highlight .vc { color: #B8860B } /* Name.Variable.Class */ 59 | .highlight .vg { color: #B8860B } /* Name.Variable.Global */ 60 | .highlight .vi { color: #B8860B } /* Name.Variable.Instance */ 61 | .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ 62 | -------------------------------------------------------------------------------- /html/css/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | * HTML Slideshow 3 | * Orignal uthor: Rob Flaherty | rob@ravelrumba.com 4 | */ 5 | 6 | /* Meyer Reset */ 7 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline}:focus{outline:0}body{line-height:1;color:black;background:white}ol,ul{list-style:none}table{border-collapse:separate;border-spacing:0}caption,th,td{text-align:left;font-weight:normal}blockquote:before,blockquote:after,q:before,q:after{content:""}blockquote,q{quotes:""""} 8 | 9 | /* Core Styles */ 10 | html{ font-size:100%; overflow: hidden; } 11 | body { font-size: 62.5%; line-height: 1.5; font-family: "Helvetica Neue", Helvetica, Arial, Sans-serif; color: #333; } 12 | input, select, textarea { font-family: "Helvetica Neue", Helvetica, Arial, Sans-serif; font-size: 1em; } 13 | :focus { outline: 1px; } 14 | strong{ font-weight:bold; } 15 | em { font-style: italic; } 16 | hr { display: none; } 17 | img { display: block; } 18 | a img { border: none; } 19 | cite { font-style: normal; } 20 | code { padding: 0 3px; } 21 | blockquote { margin:0 0 24px 32px; border-left:7px solid #ececec; padding-left:16px; } 22 | blockquote p { margin:0; } 23 | .center { text-align: center; margin: 0 auto; } 24 | .left { float: left; } 25 | .right { float: right; } 26 | article, aside, dialog, figure, footer, header, hgroup, menu, nav, section { display: block; } 27 | 28 | /* Links */ 29 | a:link, a:visited, a:active { color: #3c5dc9; text-decoration: underline; } 30 | a:hover { color: #3c5dc9; text-decoration:none; } 31 | 32 | span.highlight { background-color: #ffdeb8; font-weight: bold; color: #5a0b05; } 33 | 34 | /* Slider App Styles */ 35 | section { padding: 0 30px 30px; display: none; } 36 | header { color: #000; background-image: -moz-linear-gradient(top, #c5c5c5, #b0b0b0); background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #c5c5c5),color-stop(1, #b0b0b0)); background-image: -o-linear-gradient(top, #c5c5c5, #b0b0b0); border-top:1px solid #dcdcdc; border-bottom: 1px solid rgb(105, 105, 105); text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5); font-family: "Lucida Grande"; padding: 1px 10px; overflow:hidden; z-index: 10000; position: relative; } 37 | header h1 { float: left; font-size: 18px; line-height: 32px;} 38 | .slide-selected { display: block; } 39 | .action, .action-on { display: none; } 40 | 41 | /* Slider Nav */ 42 | nav { float: right; } 43 | nav li { float: left; line-height: 32px; font-size: 14px;} 44 | nav button { float: left; border: 0; width: 26px; height: 25px; text-indent: -9999px; display: block; cursor: pointer; margin-top:4px; } 45 | #prev-btn { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAZCAYAAAAv3j5gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAkFJREFUeNpi/PTpEwMxIDw8HJkrAcTcQHyXgUjAxEA6EGRhYVmnqKjoQYomoi36//8/COsBmcd+//5tqaKiIgEVIwqzkGCRDxMT09J///7xgfhAy36BDCAWEGVRcHBwAZDqB1oCFwOxkfkUWRQYGAiSnwHEydiCkioW+fv7izMyMq4EGmiPTR4o959ii3x9fY2A8bHu79+/8rg0/vjxgxVoESeR9vxhRM9H3t7e4UDXzgf6BK8hwCT+GeiQL0QlbSamlSg+8vT0rAFSzcRo/vXrFy+Q4iVGrbq6ugPYIjc3N1AunwrE8Qw0AMzMzKwsLi4u+sCgWgwMKl0GGgFQCmUCRryymJiYIixf0Aozb9y4kcnd3d3oyZMnYvfv32clpVghFktISLwGlXVXeXh4vBobG+dFR0d/oYVv/vz5wwhLdV+BOCctLe2+tLR0TU9PD//Pnz8Z8YU70HH/WFlZiYojLi6un4xY6qPAS5cuTa6trZV4+fIlMy7N9fX1Tx0cHN4RmR42MuKo+AyeP38+v7q6WuvKlSts2BSEhIQ0lpWVdRBp0V9cZd0FSUlJjxkzZswCxp3rzp07ObEUQX9MTEx+UKPie8nGxhbS2to6KzMz8xN6BANTEyMpCYJQDfsbiAuSk5MrOjs733Nycv5HsoiBmhbBwHRXV9eI6dOnP5KRkflDS4sYdHV1d+np6fksWLDgDJD9CxhH7KRkWpIaJzo6OldERES8gEn/kKWl5TNSLGIktl2HBhSgleYdYjUABBgAOCl8S+xfAp8AAAAASUVORK5CYII=) no-repeat; margin-right: 10px;line-height: 32px; } 46 | #next-btn { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAZCAYAAAAv3j5gAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAjdJREFUeNpi/PTpEwOxIDw8XBlIfV25cuULBhIBEymKFRUVPVhYWNYBLRSkqUUqKioSv3//tgQyj4WFhenRzCKgJb/+///P8O/fPw1GRsbDoaGhPjSxCGgBHP/584cPSG8ODg4uoLpFUN+g4/7AwMA5QMxCNYuAwfUfi0UgnAx0xB5/f39xXHpZfH19WUE0MRY5ODiwggzGAeyZmJhOAs0L2rx58zkMRwI19wM1hxNjETMzMw8wbngJ+Po70HeJW7duXYkinpqaev7atWsGDNQHtdu3b2+BBx3Qlax///6lgT0MzW5ubipAOnvXrl1fWWApiUYgHhiURi4uLrEssJRDKyApKaloZmamDLaIRkEHSqXfS0tLz/Hw8NxkAaYiRlr4KDY29ktaWtpCILMcVOKzcHFx/eTj4/tHZFnH8OXLF7yZnJ2d/X9JSclHb29vUIrrhSfvly9fNgNpf2IsOnDggFBjY6M0LnlxcfG/zc3NL/T09HKB3PUoJQMnJ2cTkG4lxqLLly9XAIO5Hpucjo7Or9bW1mvAyE8Eci9gFEGgEIFiguDHjx9/sMWnu7v79/r6+t1sbGxpQO5LrGUdiaU3RsLJzs7+lJycPB/ILMXnYFItguc5bm7u/w0NDR9cXV2rgdzphPSSZZGcnNyftra2p8BIBwXVLmL0kmQRMI7YdXV1f02cOPGciIhIKlDoCrF6SbLI0tLymYaGxiGgJWFA7nuSKk1S2nWghhAQ/wHiB6SWFAABBgC+fxD2vIG/7gAAAABJRU5ErkJggg==) no-repeat; margin-left:9px; } 47 | 48 | /* General Slide Styles */ 49 | .slide h1 { font-size: 32px; } 50 | .slide h2 { font-size: 26px; } 51 | .slide p { font-size: 20px; margin: 0 0 1em; } 52 | .slide ul li { list-style-type: disc; margin-left: 40px; font-size: 20px; } 53 | .slide ol li { list-style-type: decimal; margin-left: 40px; font-size: 20px; } 54 | .slide pre { font-size:20px; font-family: monospace; } 55 | .slide hgroup { margin: 0 0 20px; } 56 | 57 | /* Center graphics and media content */ 58 | .slide img, .slide video, .slide canvas, .slide figure, .slide object, .slide embed { margin:0 auto; } 59 | .slide .fullscreen { position: absolute; left:0; top:0; width:100%; z-index:1; } 60 | 61 | /* Additional styles */ 62 | html, 63 | body { background: #f5f6f6; height: 100%; } 64 | #deck { min-height: 100%; } 65 | #deck h1 { font-family: 'Marker Felt', Impact, Arial, sans-serif; font-size:50px; text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8); } 66 | #deck h2 { font-family: 'Marker Felt', Impact, Arial, sans-serif; font-size: 30px; text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8); } 67 | #deck p, 68 | #deck li, 69 | #deck table th, 70 | #deck blockquote, 71 | #deck table td { font-family: Arial, sans-serif; font-size:20px; text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.8); } 72 | #deck code { font-family: Monaco, monospace; background-color: #f8f8ff; color: #444; padding: 1px 3px; border: 1px solid #dedede; border-radius: 2px; } 73 | #deck pre { margin-bottom: 1em; } 74 | #deck kbd { font-family: Monaco, monospace; } 75 | #deck section:first-child hgroup { text-align: center; padding-top: 100px !important; } 76 | 77 | #deck table { border-collapse: collapse; margin-bottom: 2em; } 78 | #deck table th { background-color: #dddddd; } 79 | #deck table th, 80 | #deck table td { padding: 0.5em 1em; border: 3px solid gray; } 81 | #deck ul, 82 | #deck ol { margin-bottom: 2em; } 83 | #deck .answer { color: #6a6; font-style: italic; } 84 | #deck blockquote { font-style: italic; } 85 | 86 | ::-moz-selection { background: #350e0e; color: #fff; text-shadow: none; /* Gecko Browsers */ } 87 | ::selection { background: #350e0e; color: #fff; text-shadow: none; /* WebKit/Blink Browsers */ } 88 | -------------------------------------------------------------------------------- /html/images/captcha-challenge-accepted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/html/images/captcha-challenge-accepted.png -------------------------------------------------------------------------------- /html/images/rdoc-apidock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/html/images/rdoc-apidock.png -------------------------------------------------------------------------------- /html/images/rdoc-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/html/images/rdoc-default.png -------------------------------------------------------------------------------- /html/images/rdoc-rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/html/images/rdoc-rails.png -------------------------------------------------------------------------------- /html/images/rdoc-yard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fmi/python-lectures/515b7af910d263ce641776cdfd0664490128d1aa/html/images/rdoc-yard.png -------------------------------------------------------------------------------- /html/js/html5shim.js: -------------------------------------------------------------------------------- 1 | // html5shiv MIT @rem remysharp.com/html5-enabling-script 2 | // iepp v1.6.2 MIT @jon_neal iecss.com/print-protector 3 | /*@cc_on(function(a,b){function r(a){var b=-1;while(++b";return a.childNodes.length!==1}())){a.iepp=a.iepp||{};var c=a.iepp,d=c.html5elements||"abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",e=d.split("|"),f=e.length,g=new RegExp("(^|\\s)("+d+")","gi"),h=new RegExp("<(/*)("+d+")","gi"),i=/^\s*[\{\}]\s*$/,j=new RegExp("(^|[^\\n]*?\\s)("+d+")([^\\n]*)({[\\n\\w\\W]*?})","gi"),k=b.createDocumentFragment(),l=b.documentElement,m=l.firstChild,n=b.createElement("body"),o=b.createElement("style"),p=/print|all/,q;c.getCSS=function(a,b){if(a+""===undefined)return"";var d=-1,e=a.length,f,g=[];while(++d section').size(); 30 | this.prevButton = $('#prev-btn'); 31 | this.nextButton = $('#next-btn'); 32 | this.slideNumber = $('#slide-number'); 33 | 34 | //Add ids and classes to slides 35 | $('#deck > section').each(function(index, el) { 36 | $el = $(el); 37 | $el.attr('id', 'slide' + (index +1)); 38 | $el.addClass('slide'); 39 | }); 40 | 41 | //Set total slide count in header 42 | $('#slide-total').html(this.slideCount); 43 | 44 | //Check for hash and validate value 45 | if (this.slideHash && (parseInt((this.slideHash.substring(1)), 10) <= this.slideCount)) { 46 | this.currentSlide = parseInt(this.slideHash.replace('#', ''), 10); 47 | } 48 | 49 | //Hide toolbar if hideToolbar === true 50 | if (settings.hideToolbar === true) { 51 | setTimeout(function(){ 52 | $('header').fadeTo(300, 0); 53 | }, 1500); 54 | 55 | $('header').hover( 56 | function() { 57 | $('header').fadeTo(300, 1); 58 | }, 59 | function() { 60 | $('header').fadeTo(300, 0); 61 | } 62 | ); 63 | } 64 | 65 | //Bind control events 66 | this.prevButton.bind('click', $.proxy(this, 'prevSlide')); 67 | this.nextButton.bind('click', $.proxy(this, 'showActions')); 68 | $('html').bind('keydown', $.proxy(this, 'keyControls')); 69 | 70 | //Set initial slide 71 | this.changeSlide(this.currentSlide); 72 | 73 | //Ensure focus stays on window and not embedded iframes/objects 74 | $(window).load(function() { 75 | this.focus(); 76 | }); 77 | 78 | //Swipe gestures 79 | $('.slide').swipe({ 80 | threshold: { 81 | x: 20, 82 | y: 30 83 | }, 84 | swipeLeft: function() { 85 | base.showActions.apply(base); 86 | }, 87 | swipeRight: function() { 88 | base.prevSlide.apply(base); 89 | }, 90 | }); 91 | 92 | }, 93 | 94 | //Change slide 95 | changeSlide: function(id) { 96 | var slideID = '#slide' + id; 97 | 98 | //Update slide classes 99 | this.deck.find('.slide-selected').removeClass('slide-selected'); 100 | $(slideID).addClass('slide-selected'); 101 | 102 | //Update toolbar 103 | this.slideNumber.html(this.currentSlide); 104 | 105 | //Update hash 106 | location.hash = id; 107 | 108 | //Trigger newSlide event 109 | this.newSlideEvent(id); 110 | 111 | //Hide arrows on first and last slides 112 | if ((id != 1) && (id != this.slideCount)) { 113 | this.prevButton.css('visibility', 'visible'); 114 | this.nextButton.css('visibility', 'visible'); 115 | } else if (id == 1) { 116 | this.prevButton.css('visibility', 'hidden'); 117 | } else if (id == this.slideCount) { 118 | this.nextButton.css('visibility', 'hidden'); 119 | } 120 | }, 121 | 122 | //Next slide 123 | prevSlide: function() { 124 | if (this.currentSlide > 1) { 125 | this.currentSlide--; 126 | this.changeSlide(this.currentSlide); 127 | } 128 | }, 129 | 130 | //Previous slide 131 | nextSlide: function() { 132 | if (this.currentSlide < this.slideCount) { 133 | this.currentSlide++; 134 | this.changeSlide(this.currentSlide); 135 | } 136 | }, 137 | 138 | //Reveal actions 139 | showActions: function() { 140 | var actions = $('.slide-selected').find('.action'), 141 | actionOns; 142 | 143 | //If actions exist 144 | if (actions.length > 0) { 145 | actions.first().removeClass('action').addClass('action-on').fadeIn(250); 146 | 147 | //Number of current action 148 | actionOns = $('.slide-selected').find('.action-on'); 149 | 150 | //Trigger newAction event 151 | $('html').trigger("newAction", actionOns.length ); 152 | } else { 153 | this.nextSlide(); 154 | } 155 | }, 156 | 157 | newSlideEvent: function(id) { 158 | $('html').trigger('newSlide', id); 159 | }, 160 | 161 | //Keyboard controls 162 | keyControls: function(event) { 163 | switch(event.keyCode) { 164 | //Left, up, and page up keys 165 | case 33: 166 | case 37: 167 | case 38: 168 | this.prevSlide(); 169 | break; 170 | //Right, down, spacebar, and page down keys 171 | case 32: 172 | case 34: 173 | case 39: 174 | case 40: 175 | this.showActions(); 176 | break; 177 | } 178 | } 179 | 180 | }; 181 | -------------------------------------------------------------------------------- /html/js/jquery-3.7.1.min.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ 2 | !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 0 (defaults.threshold.y*-1)) { 62 | changeX = originalCoord.x - finalCoord.x 63 | 64 | if(changeX > defaults.threshold.x) { 65 | defaults.swipeLeft() 66 | } 67 | if(changeX < (defaults.threshold.x*-1)) { 68 | defaults.swipeRight() 69 | } 70 | } 71 | } 72 | 73 | // Swipe was started 74 | function touchStart(event) { 75 | //console.log('Starting swipe gesture...') 76 | originalCoord.x = event.targetTouches[0].pageX 77 | originalCoord.y = event.targetTouches[0].pageY 78 | 79 | finalCoord.x = originalCoord.x 80 | finalCoord.y = originalCoord.y 81 | } 82 | 83 | // Swipe was canceled 84 | function touchCancel(event) { 85 | //console.log('Canceling swipe gesture...') 86 | } 87 | 88 | // Add gestures to all swipable areas 89 | this.addEventListener("touchstart", touchStart, false); 90 | this.addEventListener("touchmove", touchMove, false); 91 | this.addEventListener("touchend", touchEnd, false); 92 | this.addEventListener("touchcancel", touchCancel, false); 93 | 94 | }); 95 | }; 96 | })(jQuery); -------------------------------------------------------------------------------- /html/layout.slim: -------------------------------------------------------------------------------- 1 | doctype 5 2 | html lang='bg' 3 | head 4 | meta charset='utf-8' 5 | /[ if lt IE 9 ] 6 | script src='js/html5shim.js' 7 | link rel='stylesheet' href='css/styles.css' 8 | link rel='stylesheet' href='css/pygments.css' 9 | title = title 10 | body 11 | header 12 | h1 = title 13 | nav 14 | ul 15 | li 16 | button id='prev-btn' title='Previous slide' Previous Slide 17 | li 18 | span id='slide-number' 19 | ' / 20 | span id='slide-total' 21 | li 22 | button id='next-btn' title='Next Slide' Next Slide 23 | 24 | div#deck 25 | section 26 | hgroup 27 | h1 = title 28 | h2 = date 29 | 30 | - if image 31 | img.intro src="#{image}" 32 | 33 | = slides_html 34 | 35 | section 36 | hgroup 37 | h1 Въпроси? 38 | 39 | ul 40 | li 41 | a href="http://fmi.py-bg.net/topics" http://fmi.py-bg.net/ 42 | li 43 | a href="mailto:fmi@py-bg.net" fmi@py-bg.net 44 | li 45 | a href="http://twitter.com/pyfmi/" @pyfmi 46 | script src="js/jquery-3.7.1.min.js" 47 | script src="js/jquery.jswipe-0.1.2.js" 48 | script src="js/htmlSlides.js" 49 | javascript: 50 | $(function() { 51 | htmlSlides.init({ hideToolbar: true }); 52 | }); 53 | -------------------------------------------------------------------------------- /lectures/index.yml: -------------------------------------------------------------------------------- 1 | 0: 2 | title: 00. Нулева лекция 3 | date: 2022-10-06 4 | url: lectures/00-intro.pdf 5 | 1: 6 | title: 01. Въведение в Python 7 | date: 2022-10-11 8 | url: lectures/01-intro-to-python.pdf 9 | 2: 10 | title: 2. Колекции 11 | date: 2022-10-13 12 | url: lectures/02-collections.pdf 13 | 3: 14 | title: 3. Декоратори 15 | date: 2022-10-18 16 | url: lectures/03-decorators.pdf 17 | 4: 18 | title: 4. ООП 19 | date: 2022-10-20 20 | url: lectures/04-oop.pdf 21 | 5: 22 | title: 05. Домашни дискусии 23 | date: 2022-10-25 24 | url: lectures/05-home-work-discussions.pdf 25 | 6: 26 | title: 06. ООП 2 27 | date: 2022-10-27 28 | url: lectures/06-oop-2.pdf 29 | 7: 30 | title: 07. Изключения и with 31 | date: 2022-11-03 32 | url: lectures/07-exceptions-and-with.pdf 33 | 8: 34 | title: 08. Итератори и Генератори 35 | date: 2022-11-08 36 | url: lectures/08-iterators-and-generators.pdf 37 | 9: 38 | title: 09. DnD Workshop (Очаквайте скоро) 39 | date: 2022-11-10 40 | url: lectures/09.TBD 41 | 10: 42 | title: 10. Модули 43 | date: 2022-11-17 44 | url: lectures/10-modules.pdf 45 | 11: 46 | title: 11. RegEx и venv 47 | date: 2022-11-22 48 | url: lectures/11-regex-and-environments.pdf 49 | 12: 50 | title: 12. Метаобектен протокол 51 | date: 2022-11-24 52 | url: lectures/12-meta-object-protocol.pdf 53 | 13: 54 | title: 13. Метапрограмиране 55 | date: 2022-11-29 56 | url: lectures/13-metaprogramming.pdf 57 | 14: 58 | title: 14. Django 1 59 | date: 2022-12-01 60 | url: lectures/14-django-1.pdf 61 | 15: 62 | title: 15. Django 2 63 | date: 2022-12-06 64 | url: lectures/15-django-2.pdf 65 | 16: 66 | title: 16. C + Python 67 | date: 2022-12-13 68 | url: lectures/16-c-python.pdf 69 | 17: 70 | title: 17. Конкурентност 71 | date: 2022-12-15 72 | url: lectures/17-concurrency.pdf 73 | 18: 74 | title: 18. Роботика 75 | date: 2022-12-20 76 | url: lectures/18-robotics.pdf 77 | 19: 78 | title: 19. NumPy & Pandas 79 | date: 2023-01-03 80 | url: lectures/19-numpy-and-pandas.pdf 81 | 20: 82 | title: 20. Анализ и YouTube faces 83 | date: 2023-01-05 84 | url: lectures/20-analysis-and-youtube-faces.pdf 85 | 21: 86 | title: 21. Pygame и каквото още се сетихме 87 | date: 2023-01-10 88 | url: lectures/21-pygame-and-stuff.pdf -------------------------------------------------------------------------------- /lib/slides.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'slim' 3 | require 'yaml' 4 | require 'pygments' 5 | require 'fileutils' 6 | require 'rcodetools/xmpfilter' 7 | 8 | $:.unshift File.dirname(__FILE__) + '/slides' 9 | 10 | autoload :Example, 'example' 11 | autoload :Text, 'text' 12 | autoload :Annotate, 'annotate' 13 | autoload :List, 'list' 14 | autoload :SlideHelper, 'slide_helper' 15 | autoload :Lecture, 'lecture' 16 | autoload :Builder, 'builder' 17 | autoload :Code, 'code' 18 | 19 | Slim::Engine.default_options[:disable_escape] = true 20 | 21 | Slim::EmbeddedEngine.register :example, Example 22 | Slim::EmbeddedEngine.register :text, Text 23 | Slim::EmbeddedEngine.register :annotate, Annotate 24 | Slim::EmbeddedEngine.register :list, List 25 | 26 | module Slides 27 | def self.lectures_path 28 | @lectures_path ||= File.realpath( 29 | ENV['PYTHON_LECTURES_PATH'] || File.dirname(File.dirname(__FILE__)) + '/lectures' 30 | ) 31 | end 32 | 33 | def self.compiled_lectures_path 34 | @compiled_lectures_path ||= 35 | ENV['PYTHON_COMPILED_LECTURES_PATH'] || File.dirname(lectures_path) + '/compiled-lectures' 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/slides/annotate.rb: -------------------------------------------------------------------------------- 1 | class Annotate < Slim::Filter 2 | def on_slim_embedded(engine, body) 3 | code = Slim::CollectText.new.call(body) 4 | code = annotate code 5 | html = Code.highlight code 6 | 7 | [:static, html] 8 | end 9 | 10 | private 11 | 12 | def annotate(input) 13 | input = input.gsub /^(.*)\n(\s*)#!$/u, '(\1) rescue $!.class \2 # =>' 14 | input = input.gsub /^(.*) ?#!$/u, '(\1) rescue $!.class # =>' 15 | 16 | # Make sure the XMPFilter class is loaded, because it sets the default 17 | # encoding for external strings to ASCII-8BIT and we need to revert it to 18 | # something better, like UTF-8. 19 | Rcodetools::XMPFilter 20 | Encoding.default_external = 'UTF-8' 21 | 22 | output = Rcodetools::XMPFilter.new( 23 | warnings: false, 24 | # For multiline results, max line width to allow before word wrapping 25 | # will occur. Results are treated as multiline if the annotation marker 26 | # appears on a newline by itself (optionally preceeded by whitespace). 27 | width: 80 28 | ).annotate(input).join('') 29 | 30 | output = output.gsub /^\((.*)\) rescue \$!\.class (\s*) # =>\s*(.*)$/u, "\\1\n\\2# => error: \\3" 31 | output = output.gsub /^\((.*)\) rescue \$!\.class # =>\s*(.*)$/u, '\1# => error: \2' 32 | output 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/slides/annotator.rb: -------------------------------------------------------------------------------- 1 | class Annotator 2 | def initialize(code) 3 | @code = code 4 | end 5 | 6 | def execute 7 | marked_code, mark_count = add_marks @code 8 | if mark_count > 0 9 | collecting = add_mark_collecting marked_code 10 | values = run_code collecting 11 | replace_marks marked_code, values 12 | else 13 | marked_code 14 | end 15 | end 16 | 17 | private 18 | 19 | def add_marks(code) 20 | counter = 0 21 | marked = code.gsub(/# =>$/) do |mark| 22 | counter += 1 23 | "# {#{counter}}" 24 | end 25 | [marked, counter] 26 | end 27 | 28 | def add_mark_collecting(code) 29 | code = code.gsub(/\A/, <<-HEADER).gsub(/\z/, <<-FOOTER) 30 | import json 31 | __marks__ = {} 32 | __dumps__ = repr 33 | 34 | HEADER 35 | 36 | print(json.dumps(__marks__)) 37 | FOOTER 38 | code = code.gsub(/^(\s*)(.*?)\s*# {(\d+)}$/) { <<-END } 39 | #$1try: __marks__[#$3] = __dumps__(#$2) 40 | #$1except Exception as e: __marks__[#$3] = __dumps__(e) 41 | END 42 | code 43 | end 44 | 45 | def run_code(code) 46 | Open3.popen3('python3') do |stdin, stdout, stderr| 47 | stdin.puts code 48 | stdin.close 49 | 50 | puts stderr.read 51 | 52 | JSON.parse stdout.read 53 | end 54 | end 55 | 56 | def replace_marks(marked, values) 57 | marked.gsub(/# {(\d+)}$/) { "# #{values[$1]}" } 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/slides/builder.rb: -------------------------------------------------------------------------------- 1 | class Builder 2 | attr_accessor :title, :date, :slug, :image, :lectures_path, :templates_path 3 | 4 | def initialize(attributes) 5 | attributes.each do |key, value| 6 | send "#{key}=", value 7 | end 8 | end 9 | 10 | def html 11 | input = File.read source_file 12 | lecture = Lecture.new input, title, date, image 13 | 14 | lecture.render(layout_file: "#{templates_path}/html/layout.slim") 15 | end 16 | 17 | def output_filename 18 | "#@slug.html" 19 | end 20 | 21 | private 22 | 23 | def source_file 24 | "#{lectures_path}/#@slug.slim" 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/slides/code.rb: -------------------------------------------------------------------------------- 1 | class Code 2 | def self.highlight(code, lexer: :python) 3 | Pygments.highlight(code, lexer: lexer) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /lib/slides/example.rb: -------------------------------------------------------------------------------- 1 | class Example < Slim::Filter 2 | def on_slim_embedded(engine, body) 3 | code = Slim::CollectText.new.call(body) 4 | html = Code.highlight code 5 | [:static, html] 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/slides/lecture.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | class Lecture 3 | MONTHS = %w(януари февруари март април май юни юли август септември октомври ноември декември) 4 | 5 | attr_reader :title, :date, :slug, :image, :slides_html 6 | 7 | def initialize(input, title, date, image) 8 | @title = title 9 | @date = date 10 | @image = image 11 | @slides_html = generate_html input 12 | end 13 | 14 | def render(layout_file: nil) 15 | Slim::Template.new(layout_file).render(self) 16 | end 17 | 18 | def date 19 | "#{@date.day} #{MONTHS[@date.month.pred]} #{@date.year}" 20 | end 21 | 22 | private 23 | 24 | def generate_html(input) 25 | Slim::Template.new { input }.render(SlideHelper.new) 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/slides/list.rb: -------------------------------------------------------------------------------- 1 | class List < Slim::Filter 2 | class Line 3 | def initialize(line) 4 | @line = line 5 | end 6 | 7 | def render 8 | extract_verbatim_code_blocks 9 | convert_double_dash_to_mdash 10 | parse_github_links 11 | parse_markdown_links 12 | inject_verbatim_code_blocks 13 | 14 | @line 15 | end 16 | 17 | private 18 | 19 | def convert_double_dash_to_mdash 20 | @line = @line.gsub('--', '—') 21 | end 22 | 23 | def parse_github_links 24 | @line = @line.gsub(/\[github:([^\]]*?)\]/, '\1') 25 | end 26 | 27 | def parse_markdown_links 28 | @line = @line.gsub(/\[([^\]]+)\]\((\S+?)\)/, '\1') 29 | end 30 | 31 | def extract_verbatim_code_blocks 32 | @verbatim_code_blocks = {} 33 | 34 | @line = @line.gsub(/`(.*?)`/) do |match| 35 | code = match[1...-1] 36 | slug = "" 37 | 38 | @verbatim_code_blocks[slug] = "#{h code}" 39 | 40 | slug 41 | end 42 | end 43 | 44 | def inject_verbatim_code_blocks 45 | @verbatim_code_blocks.each do |slug, code| 46 | @line = @line.gsub(slug, code) 47 | end 48 | end 49 | 50 | def h(html) 51 | Temple::Utils.escape_html html 52 | end 53 | end 54 | 55 | def on_slim_embedded(engine, body) 56 | code = Slim::CollectText.new.call(body) 57 | items = code.lines.map do |line| 58 | %{
  • #{Line.new(line).render}
  • } 59 | end 60 | html = "
      #{items.join}
    " 61 | [:static, html] 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /lib/slides/slide_helper.rb: -------------------------------------------------------------------------------- 1 | class SlideHelper 2 | def h(html) 3 | Temple::Utils.escape_html html 4 | end 5 | 6 | def slide(title, subtitle = nil) 7 | output = '' 8 | output << "
    \n" 9 | output << '
    ' 10 | output << "

    #{h title}

    " 11 | output << "

    #{h subtitle}

    " unless subtitle.nil? 12 | output << "
    \n" 13 | output << yield 14 | output << "
    \n" 15 | output 16 | end 17 | 18 | def github_repo(repo) 19 | %{#{repo}} 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /lib/slides/text.rb: -------------------------------------------------------------------------------- 1 | class Text < Slim::Filter 2 | def on_slim_embedded(engine, body) 3 | code = Slim::CollectText.new.call(body) 4 | html = Code.highlight code, lexer: :text 5 | [:static, html] 6 | end 7 | end 8 | --------------------------------------------------------------------------------