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
150
Prototyping all the things
polarblau
2
140
CoffeeScript vs. ECMAScript 6
polarblau
5
3.2k
Design for a complex Reality — Siili Breakfast Edition
polarblau
0
97
Enabling Design for a Complex Reality
polarblau
2
110
A primer on Content Security Policy
polarblau
1
330
Rails and the future of the open web
polarblau
3
100
Brief Ruby/Ruby on Rails intro
polarblau
3
150
Ruby Idioms
polarblau
3
540
Other Decks in Programming
See All in Programming
Node.js v22 で変わること
yosuke_furukawa
PRO
2
350
Azure OpenAI Serviceのプロンプトエンジニアリング入門
tomokusaba
3
660
Code Reviews
bkuhlmann
4
890
[技育CAMPアカデミア]アイディアを形に!【超入門】スマホアプリ開発〜リリースまでの流れをご紹介
teamlab
PRO
0
360
コーンフレークから始める モデリング会話入門
ogurotakayuki
0
350
Hanami and htmx
bkuhlmann
0
200
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
26
8.2k
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
0
580
PHPはいつから死んでいるかの調査
chiroruxx
1
380
Prepare for Jakarta EE 11 - Performance and Developer Productivity
ivargrimstad
0
700
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
260
使ってみよう Azure AI Document Intelligence
kosmosebi
2
290
Featured
See All Featured
BBQ
matthewcrist
80
8.8k
Building Flexible Design Systems
yeseniaperezcruz
319
37k
GraphQLとの向き合い方2022年版
quramy
32
12k
Fireside Chat
paigeccino
21
2.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
For a Future-Friendly Web
brad_frost
172
9k
Making Projects Easy
brettharned
108
5.5k
Music & Morning Musume
bryan
41
5.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
21
1.6k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
Optimising Largest Contentful Paint
csswizardry
8
2.3k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
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