Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial import of messaging-presentation in 28c879a263f9d81e38b0323e8…
…1049e274c2fd5ff.
- Loading branch information
Jakub Stastny aka botanicus
committed
Aug 24, 2011
0 parents
commit 7416422
Showing
77 changed files
with
3,119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output | ||
vendor | ||
.rvmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# encoding: utf-8 | ||
|
||
# Use local clones if possible. | ||
# If you want to use your local copy, just symlink it to vendor. | ||
extend Module.new { | ||
def gem(name, options = Hash.new) | ||
local_path = File.expand_path("../vendor/#{name}", __FILE__) | ||
if File.exist?(local_path) | ||
super name, options.merge(path: local_path).delete_if { |key, _| [:git, :branch].include?(key) } | ||
else | ||
super name, options | ||
end | ||
end | ||
} | ||
|
||
source "http://gemcutter.org" | ||
|
||
gem "ace" | ||
gem "nake" | ||
gem "pupu" | ||
gem "nokogiri" | ||
gem "albino" | ||
gem "RedCloth" | ||
gem "template-inheritance" | ||
|
||
group(:development) do | ||
gem "rack" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
PATH | ||
remote: vendor/ace | ||
specs: | ||
ace (0.4.5) | ||
template-inheritance | ||
|
||
PATH | ||
remote: vendor/nake | ||
specs: | ||
nake (0.0.9.1) | ||
term-ansicolor | ||
|
||
PATH | ||
remote: vendor/template-inheritance | ||
specs: | ||
template-inheritance (0.3) | ||
haml | ||
tilt | ||
|
||
GEM | ||
remote: http://gemcutter.org/ | ||
specs: | ||
RedCloth (4.2.7) | ||
albino (1.3.3) | ||
posix-spawn (>= 0.3.6) | ||
haml (3.1.2) | ||
media-path (0.1.3) | ||
nokogiri (1.4.4) | ||
posix-spawn (0.3.6) | ||
pupu (0.2) | ||
media-path | ||
rack (1.3.0) | ||
term-ansicolor (1.0.5) | ||
tilt (1.3.2) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
RedCloth | ||
ace! | ||
albino | ||
nake! | ||
nokogiri | ||
pupu | ||
rack | ||
template-inheritance! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Copyright (c) 2011 Jakub Stastny aka botanicus | ||
|
||
All the logic can be used under the MIT license (see bellow). | ||
The actual articles though shall not be used by other people | ||
in any circumstances unless the author gives permission to do | ||
otherwise. In such case the copyright information shall not | ||
be omitted as well as a link to its original source. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
h1. About | ||
|
||
My presentation about messaging written in "Ace":https://github.com/botanicus/ace. | ||
|
||
h1. Usage | ||
|
||
_*NOTE:* You need Ruby 1.9.2 or later._ | ||
|
||
# Install all the dependencies via bundler: @bundle install@. | ||
# Generate the output by running @./tasks.rb generate@. | ||
# Run @./config.ru@ and view the content at "localhost:9292":http://localhost:9292/. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#!/usr/bin/env bundle exec ace | ||
# encoding: utf-8 | ||
|
||
Encoding.default_internal = "utf-8" | ||
Encoding.default_external = "utf-8" | ||
|
||
# Setup $LOAD_PATH. | ||
require "bundler/setup" | ||
|
||
# Custom setup. | ||
require "pupu/adapters/ace" | ||
Pupu.media_prefix = "/assets" | ||
|
||
require "ace" | ||
require "haml" | ||
require "ace/filters/template" | ||
require "nokogiri" | ||
require "redcloth" | ||
require "json" | ||
|
||
require_relative "lib/haml-filters" | ||
|
||
class Slide < Ace::Item | ||
before Ace::TemplateFilter, layout: "slide.html" | ||
|
||
def self.slides | ||
@slides ||= begin | ||
# Divide metadata and the actual content. | ||
site = Ace::RawItem.new("content/slides.textile.haml") | ||
site.parse | ||
|
||
# Process the content as a Haml template. | ||
# Result of this is <slide>content</slide>. | ||
engine = Haml::Engine.new(site.content) | ||
html = engine.render | ||
|
||
document = Nokogiri::HTML(html) | ||
|
||
# Process each slide manually. | ||
document.css("slide").map do |slide| | ||
metadata = slide.attributes.reduce(Hash.new) { |attrs, (name, attr)| attrs.merge(name.to_sym => attr.value) } | ||
if metadata[:title] | ||
puts "~ Generating slide #{metadata[:title]}." | ||
else | ||
puts "~ Generating anonymous slide." | ||
end | ||
|
||
case slide[:format] | ||
when "textile" | ||
textile = RedCloth.new(slide.inner_html) | ||
content = textile.to_html | ||
when nil | ||
content = slide.inner_html | ||
else | ||
raise "Format #{slide.metadata[:format]} isn't supported!" | ||
end | ||
|
||
# Create a new Slide instance for each slide. | ||
self.new(site, metadata, content) | ||
end | ||
end | ||
end | ||
|
||
# So the problem is that template filter ignores content but use the original_path. | ||
# BUT how the fuck did it work before???? | ||
|
||
# Generator method. | ||
def self.generate | ||
self.slides.each do |slide| | ||
slide.slides = self.slides | ||
slide.register | ||
end | ||
end | ||
|
||
attr_accessor :site, :slides | ||
def initialize(site, metadata, content) | ||
@site = site | ||
super(metadata, content) | ||
end | ||
|
||
def slug | ||
number = self.index + 1 | ||
if self.metadata[:title] | ||
slug = self.metadata[:title].downcase | ||
slug = slug.tr(" _", "-") | ||
slug = slug.gsub(/[^-\w\d]/, "") | ||
slug = "%02d-%s" % [number, slug] | ||
slug.gsub(/-+/, "-") | ||
else | ||
number.to_s | ||
end | ||
end | ||
|
||
def index | ||
self.slides.index(self) | ||
end | ||
|
||
def next_page | ||
slide = self.slides[self.index + 1] | ||
slide.server_path if slide | ||
end | ||
|
||
def previous_page | ||
return if self.index == 0 | ||
slide = self.slides[self.index - 1] | ||
slide.server_path if slide | ||
end | ||
|
||
def output_path | ||
"output/slides/#{self.slug}.html" | ||
end | ||
end | ||
|
||
__END__ | ||
1) onload & onunload + /stats | ||
2) generator function would add ?time=12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env rackup | ||
|
||
# This is just for development. The only thing it does | ||
# is serving of static files from the output/ directory. | ||
|
||
use Rack::Head | ||
|
||
class Server | ||
def initialize(root) | ||
@file_server = Rack::File.new(root) | ||
end | ||
|
||
def call(env) | ||
path = env["PATH_INFO"] | ||
returned = @file_server.call(env) | ||
if returned[0] == 404 && env["PATH_INFO"].end_with?("/") | ||
env["PATH_INFO"] = File.join(env["PATH_INFO"], "index.html") | ||
returned = @file_server.call(env) | ||
log "[404]", env["PATH_INFO"] if returned[0] == 404 | ||
returned | ||
else | ||
returned | ||
end | ||
end | ||
|
||
private | ||
def log(bold, message) | ||
warn "~ \033[1;31m#{bold}\033[0m #{message}" | ||
end | ||
end | ||
|
||
# /stats/:slug | ||
# ?start_time=%d&end_time=%d | ||
# map("/stats") do |env| | ||
# title, time, first, last | ||
# start_time, end_time | ||
# | ||
# # stats = {date => {slides: {slide_title => time}}, start_time: time, end_time: time, total: total} | ||
# stats = YAML::load_file("stats.yml") | ||
# date = Time.now.strftime("%d/%m/%Y") | ||
# slides = stats[date][:slides] || Hash.new | ||
# stats[date] = {slides: slides.merge(title => time)} | ||
# | ||
# # Overall statistics. | ||
# stats[date][:start_time] = start_time if start_time | ||
# stats[date][:end_time] = end_time if end_time | ||
# stats[date][:total_time] = end_time - stats[date][:start_time] | ||
# | ||
# File.open("stats.yml", "w") do |file| | ||
# file.puts(stats.to_yaml) | ||
# end | ||
# end | ||
|
||
run Server.new("output") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
.hll { background-color: #ffffcc } | ||
.c { color: #8f5902; font-style: italic } /* Comment */ | ||
.err { color: #a40000; border: 1px solid #ef2929 } /* Error */ | ||
.g { color: #000000 } /* Generic */ | ||
.k { color: #204a87; font-weight: bold } /* Keyword */ | ||
.l { color: #000000 } /* Literal */ | ||
.n { color: #000000 } /* Name */ | ||
.o { color: #ce5c00; font-weight: bold } /* Operator */ | ||
.x { color: #000000 } /* Other */ | ||
.p { color: #000000; font-weight: bold } /* Punctuation */ | ||
.cm { color: #8f5902; font-style: italic } /* Comment.Multiline */ | ||
.cp { color: #8f5902; font-style: italic } /* Comment.Preproc */ | ||
.c1 { color: #8f5902; font-style: italic } /* Comment.Single */ | ||
.cs { color: #8f5902; font-style: italic } /* Comment.Special */ | ||
.gd { color: #a40000 } /* Generic.Deleted */ | ||
.ge { color: #000000; font-style: italic } /* Generic.Emph */ | ||
.gr { color: #ef2929 } /* Generic.Error */ | ||
.gh { color: #000080; font-weight: bold } /* Generic.Heading */ | ||
.gi { color: #00A000 } /* Generic.Inserted */ | ||
.go { color: #000000; font-style: italic } /* Generic.Output */ | ||
.gp { color: #8f5902 } /* Generic.Prompt */ | ||
.gs { color: #000000; font-weight: bold } /* Generic.Strong */ | ||
.gu { color: #800080; font-weight: bold } /* Generic.Subheading */ | ||
.gt { color: #a40000; font-weight: bold } /* Generic.Traceback */ | ||
.kc { color: #204a87; font-weight: bold } /* Keyword.Constant */ | ||
.kd { color: #204a87; font-weight: bold } /* Keyword.Declaration */ | ||
.kn { color: #204a87; font-weight: bold } /* Keyword.Namespace */ | ||
.kp { color: #204a87; font-weight: bold } /* Keyword.Pseudo */ | ||
.kr { color: #204a87; font-weight: bold } /* Keyword.Reserved */ | ||
.kt { color: #204a87; font-weight: bold } /* Keyword.Type */ | ||
.ld { color: #000000 } /* Literal.Date */ | ||
.m { color: #0000cf; font-weight: bold } /* Literal.Number */ | ||
.s { color: #4e9a06 } /* Literal.String */ | ||
.na { color: #c4a000 } /* Name.Attribute */ | ||
.nb { color: #204a87 } /* Name.Builtin */ | ||
.nc { color: #000000 } /* Name.Class */ | ||
.no { color: #000000 } /* Name.Constant */ | ||
.nd { color: #5c35cc; font-weight: bold } /* Name.Decorator */ | ||
.ni { color: #ce5c00 } /* Name.Entity */ | ||
.ne { color: #cc0000; font-weight: bold } /* Name.Exception */ | ||
.nf { color: #000000 } /* Name.Function */ | ||
.nl { color: #f57900 } /* Name.Label */ | ||
.nn { color: #000000 } /* Name.Namespace */ | ||
.nx { color: #000000 } /* Name.Other */ | ||
.py { color: #000000 } /* Name.Property */ | ||
.nt { color: #204a87; font-weight: bold } /* Name.Tag */ | ||
.nv { color: #000000 } /* Name.Variable */ | ||
.ow { color: #204a87; font-weight: bold } /* Operator.Word */ | ||
.w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */ | ||
.mf { color: #0000cf; font-weight: bold } /* Literal.Number.Float */ | ||
.mh { color: #0000cf; font-weight: bold } /* Literal.Number.Hex */ | ||
.mi { color: #0000cf; font-weight: bold } /* Literal.Number.Integer */ | ||
.mo { color: #0000cf; font-weight: bold } /* Literal.Number.Oct */ | ||
.sb { color: #4e9a06 } /* Literal.String.Backtick */ | ||
.sc { color: #4e9a06 } /* Literal.String.Char */ | ||
.sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */ | ||
.s2 { color: #4e9a06 } /* Literal.String.Double */ | ||
.se { color: #4e9a06 } /* Literal.String.Escape */ | ||
.sh { color: #4e9a06 } /* Literal.String.Heredoc */ | ||
.si { color: #4e9a06 } /* Literal.String.Interpol */ | ||
.sx { color: #4e9a06 } /* Literal.String.Other */ | ||
.sr { color: #4e9a06 } /* Literal.String.Regex */ | ||
.s1 { color: #4e9a06 } /* Literal.String.Single */ | ||
.ss { color: #4e9a06 } /* Literal.String.Symbol */ | ||
.bp { color: #3465a4 } /* Name.Builtin.Pseudo */ | ||
.vc { color: #000000 } /* Name.Variable.Class */ | ||
.vg { color: #000000 } /* Name.Variable.Global */ | ||
.vi { color: #000000 } /* Name.Variable.Instance */ | ||
.il { color: #0000cf; font-weight: bold } /* Literal.Number.Integer.Long */ |
Empty file.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// generator("next"); | ||
function generator (property) { | ||
return function () { | ||
if (page[property]) { | ||
window.location = page[property] | ||
}; | ||
}; | ||
}; | ||
|
||
window.addEvent("domready", function (event) { | ||
window.addEvent("click", generator("next")); | ||
|
||
window.addEvent("keydown", function (event) { | ||
switch (event.key) { | ||
case "right": | ||
fn = generator("next") | ||
fn(); break; | ||
case "enter": | ||
fn = generator("next") | ||
fn(); break; | ||
case "left": | ||
fn = generator("previous") | ||
fn(); break; | ||
}; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
*~ | ||
.*.swp | ||
.#* | ||
.svn/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[12/2/2008] First public release |
Oops, something went wrong.