From 740ca0666970c0e0ae50193bda8e4c07b81905bc Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 12 May 2015 14:42:45 -0400 Subject: [PATCH] Initial commit --- .bowerrc | 3 + .editorconfig | 10 +++ .gitignore | 6 ++ .jshintrc | 19 +++++ .yo-rc.json | 10 +++ Gruntfile.coffee | 160 ++++++++++++++++++++++++++++++++++++++++ bower.json | 8 ++ css/source/theme.scss | 57 ++++++++++++++ css/theme.css | 149 +++++++++++++++++++++++++++++++++++++ css/theme.css.map | 7 ++ js/loadhtmlslides.js | 44 +++++++++++ package.json | 23 ++++++ slides/index.md | 10 +++ slides/list.json | 1 + templates/_index.html | 93 +++++++++++++++++++++++ templates/_section.html | 5 ++ 16 files changed, 605 insertions(+) create mode 100644 .bowerrc create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 .yo-rc.json create mode 100644 Gruntfile.coffee create mode 100644 bower.json create mode 100644 css/source/theme.scss create mode 100644 css/theme.css create mode 100644 css/theme.css.map create mode 100644 js/loadhtmlslides.js create mode 100644 package.json create mode 100644 slides/index.md create mode 100644 slides/list.json create mode 100644 templates/_index.html create mode 100644 templates/_section.html diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..69fad35 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "bower_components" +} diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0ea0cc4 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6065d09 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +node_modules +bower_components +dist +*.log +.sass-cache +index.html diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..855a9ef --- /dev/null +++ b/.jshintrc @@ -0,0 +1,19 @@ +{ + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "indent": 4, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "smarttabs": true, + "white": true +} diff --git a/.yo-rc.json b/.yo-rc.json new file mode 100644 index 0000000..96ea9a1 --- /dev/null +++ b/.yo-rc.json @@ -0,0 +1,10 @@ +{ + "generator-reveal": { + "presentationTitle": "Ruby Can Do Computer Sciency THings", + "packageVersion": "0.0.0", + "useSass": true, + "deployToGithubPages": true, + "githubUsername": "atomaka", + "githubRepository": "ruby-project-euler-talk" + } +} \ No newline at end of file diff --git a/Gruntfile.coffee b/Gruntfile.coffee new file mode 100644 index 0000000..62238e2 --- /dev/null +++ b/Gruntfile.coffee @@ -0,0 +1,160 @@ +# Generated on 2015-05-12 using generator-reveal 0.4.0 +module.exports = (grunt) -> + + grunt.initConfig + + watch: + + livereload: + options: + livereload: true + files: [ + 'index.html' + 'slides/{,*/}*.{md,html}' + 'js/*.js' + 'css/*.css' + ] + + index: + files: [ + 'templates/_index.html' + 'templates/_section.html' + 'slides/list.json' + ] + tasks: ['buildIndex'] + + coffeelint: + files: ['Gruntfile.coffee'] + tasks: ['coffeelint'] + + jshint: + files: ['js/*.js'] + tasks: ['jshint'] + + sass: + files: ['css/source/theme.scss'] + tasks: ['sass'] + + sass: + + theme: + files: + 'css/theme.css': 'css/source/theme.scss' + + connect: + + livereload: + options: + port: 9000 + # Change hostname to '0.0.0.0' to access + # the server from outside. + hostname: 'localhost' + base: '.' + open: true + livereload: true + + coffeelint: + + options: + indentation: + value: 4 + max_line_length: + level: 'ignore' + + all: ['Gruntfile.coffee'] + + jshint: + + options: + jshintrc: '.jshintrc' + + all: ['js/*.js'] + + copy: + + dist: + files: [{ + expand: true + src: [ + 'slides/**' + 'bower_components/**' + 'js/**' + 'css/*.css' + ] + dest: 'dist/' + },{ + expand: true + src: ['index.html'] + dest: 'dist/' + filter: 'isFile' + }] + + + buildcontrol: + + options: + dir: 'dist' + commit: true + push: true + message: 'Built from %sourceCommit% on branch %sourceBranch%' + pages: + options: + remote: 'git@github.com:atomaka/ruby-project-euler-talk.git' + branch: 'gh-pages' + + + + # Load all grunt tasks. + require('load-grunt-tasks')(grunt) + + grunt.registerTask 'buildIndex', + 'Build index.html from templates/_index.html and slides/list.json.', + -> + indexTemplate = grunt.file.read 'templates/_index.html' + sectionTemplate = grunt.file.read 'templates/_section.html' + slides = grunt.file.readJSON 'slides/list.json' + + html = grunt.template.process indexTemplate, data: + slides: + slides + section: (slide) -> + grunt.template.process sectionTemplate, data: + slide: + slide + grunt.file.write 'index.html', html + + grunt.registerTask 'test', + '*Lint* javascript and coffee files.', [ + 'coffeelint' + 'jshint' + ] + + grunt.registerTask 'serve', + 'Run presentation locally and start watch process (living document).', [ + 'buildIndex' + 'sass' + 'connect:livereload' + 'watch' + ] + + grunt.registerTask 'dist', + 'Save presentation files to *dist* directory.', [ + 'test' + 'sass' + 'buildIndex' + 'copy' + ] + + + grunt.registerTask 'deploy', + 'Deploy to Github Pages', [ + 'dist' + 'buildcontrol' + ] + + + # Define default task. + grunt.registerTask 'default', [ + 'test' + 'serve' + ] diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..6435bce --- /dev/null +++ b/bower.json @@ -0,0 +1,8 @@ +{ + "name": "ruby-can-do-computer-sciency-things", + "version": "0.0.0", + "dependencies": { + "reveal.js": "~2.6.1", + "reveal-highlight-themes": "~8.3.0" + } +} diff --git a/css/source/theme.scss b/css/source/theme.scss new file mode 100644 index 0000000..73af36f --- /dev/null +++ b/css/source/theme.scss @@ -0,0 +1,57 @@ +/** + * Default theme for reveal.js. + * + * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se + */ + +// This file has been copied over from +// ../../bower_components/reveal.js/css/theme/source/default.scss + +// Default mixins and settings ----------------- +@import "../../bower_components/reveal.js/css/theme/template/mixins"; +@import "../../bower_components/reveal.js/css/theme/template/settings"; +// --------------------------------------------- + +// Include theme-specific fonts ---------------- +@font-face { + font-family: 'League Gothic'; + src: url('../bower_components/reveal.js/lib/font/league_gothic-webfont.eot'); + src: url('../bower_components/reveal.js/lib/font/league_gothic-webfont.eot?#iefix') format('embedded-opentype'), + url('../bower_components/reveal.js/lib/font/league_gothic-webfont.woff') format('woff'), + url('../bower_components/reveal.js/lib/font/league_gothic-webfont.ttf') format('truetype'), + url('../bower_components/reveal.js/lib/font/league_gothic-webfont.svg#LeagueGothicRegular') format('svg'); + + font-weight: normal; + font-style: normal; +} + +@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); +// --------------------------------------------- + +// Override theme settings --------------------- +$heading1TextShadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0,0,0,.1), 0 0 5px rgba(0,0,0,.1), 0 1px 3px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,.2), 0 5px 10px rgba(0,0,0,.25), 0 20px 20px rgba(0,0,0,.15); +// Other options include e.g. +// $mainFont: 'Open Sans', sans-serif; +// $linkColor: #ed1dff; +// $linkColorHover: $linkColor; +// $headingFont: 'Montserrat', Impact, sans-serif; +// $headingTextShadow: none; +// $headingLetterSpacing: -0.03em; +// $headingTextTransform: none; +// $selectionBackgroundColor: #e0ad52; +// $mainFontSize: 30px; +// See ../../bower_components/reveal.js/css/theme/template/settings.scss for the full list. +// --------------------------------------------- + +// Background generator ------------------------ +@mixin bodyBackground() { + @include radial-gradient( rgba(28,30,32,1), rgba(85,90,95,1) ); +} +// --------------------------------------------- + +// Theme template ------------------------------ +@import "../../bower_components/reveal.js/css/theme/template/theme"; +// --------------------------------------------- + +// See ../../bower_components/reveal.js/css/theme/README.md +// for further explanations on how reveal.js themes work. diff --git a/css/theme.css b/css/theme.css new file mode 100644 index 0000000..e9d3433 --- /dev/null +++ b/css/theme.css @@ -0,0 +1,149 @@ +/** + * Default theme for reveal.js. + * + * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se + */ +@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); +@font-face { + font-family: 'League Gothic'; + src: url("../bower_components/reveal.js/lib/font/league_gothic-webfont.eot"); + src: url("../bower_components/reveal.js/lib/font/league_gothic-webfont.eot?#iefix") format("embedded-opentype"), url("../bower_components/reveal.js/lib/font/league_gothic-webfont.woff") format("woff"), url("../bower_components/reveal.js/lib/font/league_gothic-webfont.ttf") format("truetype"), url("../bower_components/reveal.js/lib/font/league_gothic-webfont.svg#LeagueGothicRegular") format("svg"); + font-weight: normal; + font-style: normal; } +/********************************************* + * GLOBAL STYLES + *********************************************/ +body { + background: #1c1e20; + background: -moz-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%); + background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, #555a5f), color-stop(100%, #1c1e20)); + background: -webkit-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%); + background: -o-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%); + background: -ms-radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%); + background: radial-gradient(center, circle cover, #555a5f 0%, #1c1e20 100%); + background-color: #2b2b2b; } + +.reveal { + font-family: "Lato", sans-serif; + font-size: 36px; + font-weight: normal; + letter-spacing: -0.02em; + color: #eee; } + +::selection { + color: #fff; + background: #FF5E99; + text-shadow: none; } + +/********************************************* + * HEADERS + *********************************************/ +.reveal h1, +.reveal h2, +.reveal h3, +.reveal h4, +.reveal h5, +.reveal h6 { + margin: 0 0 20px 0; + color: #eee; + font-family: "League Gothic", Impact, sans-serif; + line-height: 0.9em; + letter-spacing: 0.02em; + text-transform: uppercase; + text-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2); } + +.reveal h1 { + text-shadow: 0 1px 0 #ccc, 0 2px 0 #c9c9c9, 0 3px 0 #bbb, 0 4px 0 #b9b9b9, 0 5px 0 #aaa, 0 6px 1px rgba(0, 0, 0, 0.1), 0 0 5px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2), 0 5px 10px rgba(0, 0, 0, 0.25), 0 20px 20px rgba(0, 0, 0, 0.15); } + +/********************************************* + * LINKS + *********************************************/ +.reveal a:not(.image) { + color: #13DAEC; + text-decoration: none; + -webkit-transition: color .15s ease; + -moz-transition: color .15s ease; + -ms-transition: color .15s ease; + -o-transition: color .15s ease; + transition: color .15s ease; } + +.reveal a:not(.image):hover { + color: #71e9f4; + text-shadow: none; + border: none; } + +.reveal .roll span:after { + color: #fff; + background: #0d99a5; } + +/********************************************* + * IMAGES + *********************************************/ +.reveal section img { + margin: 15px 0px; + background: rgba(255, 255, 255, 0.12); + border: 4px solid #eee; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.15); + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -ms-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; } + +.reveal a:hover img { + background: rgba(255, 255, 255, 0.2); + border-color: #13DAEC; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.55); } + +/********************************************* + * NAVIGATION CONTROLS + *********************************************/ +.reveal .controls div.navigate-left, +.reveal .controls div.navigate-left.enabled { + border-right-color: #13DAEC; } + +.reveal .controls div.navigate-right, +.reveal .controls div.navigate-right.enabled { + border-left-color: #13DAEC; } + +.reveal .controls div.navigate-up, +.reveal .controls div.navigate-up.enabled { + border-bottom-color: #13DAEC; } + +.reveal .controls div.navigate-down, +.reveal .controls div.navigate-down.enabled { + border-top-color: #13DAEC; } + +.reveal .controls div.navigate-left.enabled:hover { + border-right-color: #71e9f4; } + +.reveal .controls div.navigate-right.enabled:hover { + border-left-color: #71e9f4; } + +.reveal .controls div.navigate-up.enabled:hover { + border-bottom-color: #71e9f4; } + +.reveal .controls div.navigate-down.enabled:hover { + border-top-color: #71e9f4; } + +/********************************************* + * PROGRESS BAR + *********************************************/ +.reveal .progress { + background: rgba(0, 0, 0, 0.2); } + +.reveal .progress span { + background: #13DAEC; + -webkit-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); + -moz-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); + -ms-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); + -o-transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); + transition: width 800ms cubic-bezier(0.26, 0.86, 0.44, 0.985); } + +/********************************************* + * SLIDE NUMBER + *********************************************/ +.reveal .slide-number { + color: #13DAEC; } + +/*# sourceMappingURL=theme.css.map */ diff --git a/css/theme.css.map b/css/theme.css.map new file mode 100644 index 0000000..8f943b5 --- /dev/null +++ b/css/theme.css.map @@ -0,0 +1,7 @@ +{ +"version": 3, +"mappings": ";;;;;AA2BQ,qFAA6E;AAZrF,UAUC;EATO,WAAW,EAAE,eAAe;EAC5B,GAAG,EAAE,uEAAuE;EAC5E,GAAG,EAAE,0YAA0G;EAK/G,WAAW,EAAE,MAAM;EACnB,UAAU,EAAE,MAAM;;;;AClB1B,IAAK;ECeJ,UAAU,EAAE,OAAM;EAClB,UAAU,EAAE,oEAAoE;EAChF,UAAU,EAAE,qHAAmH;EAC/H,UAAU,EAAE,uEAAuE;EACnF,UAAU,EAAE,kEAAkE;EAC9E,UAAU,EAAE,mEAAmE;EAC/E,UAAU,EAAE,+DAA+D;EDnB3E,gBAAgB,EEJC,OAAO;;AFOzB,OAAQ;EACP,WAAW,EELD,kBAAM;EFMhB,SAAS,EELK,IAAI;EFMlB,WAAW,EAAE,MAAM;EACnB,cAAc,EAAE,OAAO;EACvB,KAAK,EEPM,IAAI;;AFUhB,WAAY;EACX,KAAK,EEOW,IAAI;EFNpB,UAAU,EEKgB,OAAO;EFJjC,WAAW,EAAE,IAAI;;;;;AAOlB;;;;;UAKW;EACV,MAAM,EEvBS,UAAU;EFwBzB,KAAK,EEtBS,IAAI;EFwBlB,WAAW,EEzBE,mCAAe;EF0B5B,WA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8H3C,iBAAkB;EACjB,UAAU,EAAE,kBAAe;;AAE3B,sBAAuB;EACtB,UAAU,EEnIA,OAAO;EFqIjB,kBAAkB,EAAE,iDAAoD;EACrE,eAAe,EAAE,iDAAoD;EACpE,cAAc,EAAE,iDAAoD;EACnE,aAAa,EAAE,iDAAoD;EAChE,UAAU,EAAE,iDAAoD;;;;;AAM1E,qBAAsB;EACpB,KAAK,EEhJK,OAAO", +"sources": ["source/theme.scss","../bower_components/reveal.js/css/theme/template/theme.scss","../bower_components/reveal.js/css/theme/template/mixins.scss","../bower_components/reveal.js/css/theme/template/settings.scss"], +"names": [], +"file": "theme.css" +} diff --git a/js/loadhtmlslides.js b/js/loadhtmlslides.js new file mode 100644 index 0000000..aad46f3 --- /dev/null +++ b/js/loadhtmlslides.js @@ -0,0 +1,44 @@ +// Modified from markdown.js from Hakim to handle external html files +(function () { + /*jslint loopfunc: true, browser: true*/ + /*globals alert*/ + 'use strict'; + + var querySlidingHtml = function () { + var sections = document.querySelectorAll('[data-html]'), + section, j, jlen; + + for (j = 0, jlen = sections.length; j < jlen; j++) { + section = sections[j]; + + if (section.getAttribute('data-html').length) { + + var xhr = new XMLHttpRequest(), + url = section.getAttribute('data-html'), + cb = function () { + if (xhr.readyState === 4) { + if ( + (xhr.status >= 200 && xhr.status < 300) || + xhr.status === 0 // file protocol yields status code 0 (useful for local debug, mobile applications etc.) + ) { + section.innerHTML = xhr.responseText; + } else { + section.outerHTML = '
ERROR: The attempt to fetch ' + url + ' failed with the HTTP status ' + xhr.status + '. Check your browser\'s JavaScript console for more details.

'; + } + } + }; + + xhr.onreadystatechange = cb; + + xhr.open('GET', url, false); + try { + xhr.send(); + } catch (e) { + alert('Failed to get file' + url + '.' + e); + } + } + } + }; + + querySlidingHtml(); +})(); diff --git a/package.json b/package.json new file mode 100644 index 0000000..290f6ff --- /dev/null +++ b/package.json @@ -0,0 +1,23 @@ +{ + "name": "ruby-can-do-computer-sciency-things", + "version": "0.0.0", + "private": true, + "devDependencies": { + "grunt": "^0.4.5", + "grunt-contrib-sass": "^0.8.0", + "grunt-contrib-connect": "^0.9.0", + "grunt-contrib-watch": "^0.6.1", + "grunt-contrib-copy": "^0.7.0", + "grunt-contrib-jshint": "^0.10.0", + "load-grunt-tasks": "^1.0.0", + "grunt-build-control": "^0.2.2", + "grunt-coffeelint": "0.0.13" + }, + "engines": { + "node": ">=0.10.0", + "npm": ">=1.3.7" + }, + "scripts": { + "test": "grunt test" + } +} diff --git a/slides/index.md b/slides/index.md new file mode 100644 index 0000000..0a254c1 --- /dev/null +++ b/slides/index.md @@ -0,0 +1,10 @@ + +# Ruby Can Do Computer Sciency THings + +From the terminal, pop in: + + ```yo reveal:slide "Slide Title"``` + +Available options: + + ```--markdown --attributes --notes``` diff --git a/slides/list.json b/slides/list.json new file mode 100644 index 0000000..7aade68 --- /dev/null +++ b/slides/list.json @@ -0,0 +1 @@ +["index.md"] diff --git a/templates/_index.html b/templates/_index.html new file mode 100644 index 0000000..02d6054 --- /dev/null +++ b/templates/_index.html @@ -0,0 +1,93 @@ + + + + + + + Ruby Can Do Computer Sciency THings + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + <% _.forEach(slides, function(slide) { %> + <% if (!_.isArray(slide)) { %> + <%= section(slide) %> + <% } %> + <% if (_.isArray(slide)) { %> +
+ <% _.forEach(slide, function(verticalslide) { %> + <%= section(verticalslide) %> + <% }); %> +
+ <% } %> + <% }); %> +
+ +
+ + + + + + + + diff --git a/templates/_section.html b/templates/_section.html new file mode 100644 index 0000000..78cb3d4 --- /dev/null +++ b/templates/_section.html @@ -0,0 +1,5 @@ +<% if (!_.isString(slide) && !_.isArray(slide) && _.isObject(slide)) { %> +
<% if (_.isString(slide.filename)) { %>data-<% if (slide.filename.indexOf('.html') !== -1) { %>html<% } else { %>markdown<% }%>="slides/<%= slide.filename %>"<% } %>>
+<% } %><% if (_.isString(slide)) { %> +
html<% } else { %>markdown<% }%>="slides/<%= slide %>">
+<% } %>