Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Prototyping 3 — Data
Search
Florian Plank
June 12, 2012
Programming
2
170
Prototyping 3 — Data
Brief overview over YAML and how to use it within a prototype for I18n and other purposes.
Florian Plank
June 12, 2012
Tweet
Share
More Decks by Florian Plank
See All by Florian Plank
Ready, set, immersion!
polarblau
0
160
Prototyping all the things
polarblau
2
160
CoffeeScript vs. ECMAScript 6
polarblau
5
3.4k
Design for a complex Reality — Siili Breakfast Edition
polarblau
0
120
Enabling Design for a Complex Reality
polarblau
2
130
A primer on Content Security Policy
polarblau
1
390
Rails and the future of the open web
polarblau
3
110
Brief Ruby/Ruby on Rails intro
polarblau
3
170
Ruby Idioms
polarblau
3
560
Other Decks in Programming
See All in Programming
Compose Hot Reload is here, stop re-launching your apps! (Android Makers 2025)
zsmb
1
500
Develop Faster With FrankenPHP
dunglas
2
3.3k
PHPバージョンアップから始めるOSSコントリビュート / how2oss-contribute
dmnlk
1
1k
国漢文混用体からHolloまで
minhee
1
180
AI時代の開発者評価について
ayumuu
0
130
The Implementations of Advanced LR Parser Algorithm
junk0612
0
240
PHPで書いたAPIをGoに書き換えてみた 〜パフォーマンス改善の可能性を探る実験レポート〜
koguuum
0
150
On-the-fly Suggestions of Rewriting Method Deprecations
ohbarye
0
1.1k
AWSで雰囲気でつくる! VRChatの写真変換ピタゴラスイッチ
anatofuz
0
150
RuboCop: Modularity and AST Insights
koic
1
210
Being an ethical software engineer
xgouchet
PRO
0
210
Building Scalable Mobile Projects: Fast Builds, High Reusability and Clear Ownership
cyrilmottier
2
270
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
99
5.5k
Become a Pro
speakerdeck
PRO
27
5.3k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Cost Of JavaScript in 2023
addyosmani
49
7.7k
Docker and Python
trallard
44
3.3k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.2k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.3k
Why Our Code Smells
bkeepers
PRO
336
57k
Raft: Consensus for Rubyists
vanstee
137
6.9k
Done Done
chrislema
183
16k
Building Applications with DynamoDB
mza
94
6.3k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Transcript
Prototyping in the browser
III / Data
CONTENT
XML
<?xml version="1.0" encoding="UTF-8" ?> <books> <book id="1"> <title>Pride and Prejudice</title>
<author>Jane Austen</author> </book> <book id="2"> <title>Brave New World</title> <author>Aldous Huxley</author> </book> </books>
<?xml version="1.0" encoding="UTF-8" ?> <books> <book id="1"> <title>Pride and Prejudice</title>
<author>Jane Austen</author> </book> <book id="2"> <title>Brave New World</title> <author>Aldous Huxley</author> </book> </books>
“XML is like violence. — If it hasn’t solved your
problem, you’re not using enough of it.”
<?xml version="1.0" encoding="UTF-8" ?> <books> <book id="1"> <title>Pride and Prejudice</title>
<author>Jane Austen</author> </book> <book id="2"> <title>Brave New World</title> <author>Aldous Huxley</author> </book> </books>
<?xml version="1.0" encoding="UTF-8" ?> <books> <book id="1"> <title>Pride and Prejudice</title>
<author>Jane Austen</author> </book> <book id="2"> <title>Brave New World</title> <author>Aldous Huxley</author> </book> </books>
<?xml version="1.0" encoding="UTF-8" ?><books><book id="1"><title>Pride and Prejudice</title><author>Jane Austen</author></book><book id="2"><title>Brave New
World</title><author>Aldous Huxley</author></book></ books>
Length? => 216 Content length? => 60 Markup / Content
ratio? => 2.6:1
JSON
{ "books": { "book": [ { "id": 1, "title ":
" Pride and Prejudice", "author ": " Jane Austen" }, { "id": 2, "title": "Brave New World", "author": "Aldous Huxley" } ] } }
{ "books": { "book": [ { "id": 1, "title ":
"Pride and Prejudice", "author ": "Jane Austen" }, { "id": 2, "title": "Brave New World", "author": "Aldous Huxley" } ] } }
Length? => 148 Content length? => 60 Markup / Content
ratio? => 1.5:1
YAML
YAML Ain’t Markup Language* * recursive acronym
--- books: - id: 1 title: Pride and Prejudice author:
Jane Austen - id: 2 title: Brave New World author: Aldous Huxley
--- books: - id: 1 title: Pride and Prejudice author:
Jane Austen - id: 2 title: Brave New World author: Aldous Huxley
Length? => 139 (including whitespace and header) Content length? =>
60 Markup / Content ratio? => 1.3:1
I18n / serve
require File.join(File.dirname(__FILE__), 'lib', 'nested_ostruct')
require 'active_support/inflector' I18n.load_path = Dir['locale/**/*.yml'] I18n.reload!
module ViewHelpers # … def list(key, &block) data = t(key).clone
rescue {} raise data if data =~ /translation missing/ data = NestedOstruct.import(data) raise data unless data.is_a? Array data.each {|i| yield i } end def t(key, args={}) I18n.t(key, args) end end
--- en: foo: bar: Bat
#container %h2= t 'foo.bar'
--- books: - id: 1 title: Pride and Prejudice author:
Jane Austen - id: 2 title: Brave New World author: Aldous Huxley
#container %ul - list 'books' do |book| %li %strong= book.title
= "(#{book.author})"
<ul> <li> <strong>Pride and Prejudice</strong> (Jane Austen) </li> <li> <strong>Brave
New World</strong> (Aldous Huxley) </li> </ul>
PROTOTYPES