SlideShare a Scribd company logo
1 of 13
Download to read offline
Why HAML?




Kirill Zonov (graffzon)
From ERB to Haml (Step 1)
<div class="offering">
  <div class="name">
     <%= offering.name %>
  </div>
  <div class="symbol">
     <%= offering.symbol %>
  </div>
  <div class="last_price">
     <%= number_to_currency offering.last_price %>
  </div>
  <div class="last_traded_at">
     <%= last_trade_at.to_formatted_s(:short) %>
  </div>
  <div class="actions">
     <%= link_to "buy", offering_new_bid_path(offering) %>
     <% if offering.owners.find_by_user_id(session[:uid]) %>
       <%= link_to "sell", offering_new_ask_path(offering) %>
     <% end %>
  </div>
</div>
From ERB to Haml (Step 2)

<div class="offering">
  <div class="name">
     <%= offering.name %>
  <div class="symbol">
     <%= offering.symbol %>
  <div class="last_price">
     <%= number_to_currency offering.last_price %>
  <div class="last_traded_at">
     <%= last_trade_at.to_formatted_s(:short) %>
  <div class="actions">
     <%= link_to "buy", offering_new_bid_path(offering) %>
     <% if offering.owners.find_by_user_id(session[:uid]) %>
       <%= link_to "sell", offering_new_ask_path(offering) %>
From ERB to Haml (Step 3)

.offering
   .name
       = offering.name
    .symbol
       = offering.symbol
    .last_price
       = number_to_currency offering.last_price
    .last_traded_at
       = last_trade_at.to_formatted_s(:short)
    .actions
       = link_to "buy", offering_new_bid_path(offering)
       - if offering.owners.find_by_user_id(session[:uid])
          = link_to "sell", offering_new_ask_path(offering)
Main ideas of Haml

               Markup should:



● be beautiful
● be clean
● be sensible
● follow the rules
Rules of indentations

.some_div
  line one
  line two                <div class='some_div'> line one line two </div> <div
                          class='some_div_two'> line one </div>
.some_div_two             line two
  line one
line two



If we try that:
%h1 test
work?
(<h1> test
         work? </h1> )

Immediately we take error:
Illegal nesting: content can't be both given on the same line as %h1 and nested within it.
Size of code (erb)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>
      <%= configatron.app_name %> - <%= yield(:title) || 'Home' %>
   </title>
   <%= stylesheet_link_tag :flutie, 'application' %>
   <%= javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet' %>
   <%= csrf_meta_tag %>
   <%= yield(:head) %>
   <%= yield :javascript %>
 </head>
<body>
   <div class="content">
   <%= render 'layouts/navigation' %>
   <hr />
   <%= render 'layouts/messages' %>
   <% if show_title? %>
      <h1>
         <%= yield(:title) %>
      </h1>
   <% end %>
   <%= yield %>
   </div>
</body>
</html>
Size of code (haml)


!!!
%html
  %head
  %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"}
  %title #{configatron.app_name} - #{yield(:title) || 'Home'}
  = stylesheet_link_tag :flutie, 'application'
  = javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet'
  = csrf_meta_tag
  = yield(:head)
  = yield :javascript
%body .content
  = render 'layouts/navigation'
  %hr = render 'layouts/messages'
  %h1=yield(:title)
  if show_title?
    = yield
No need for words ;)
Any problems with haml?




● Perfomance problems
● Need for retraining
Perfomance

   Haml - 0.00033s
   ERB - 0.000222s
   Slim - 0.000254s
   Код:


Haml                                   ERB                                           Slim
%h1 Haml#index %p Find me in           <h1>Erb#index</h1> <p>Find me in              h1 Haml#index p Find me in
app/views/haml/index.html.erb =@haml   app/views/erb/index.html.erb</p> <%= @erb %   app/views/slim/index.html.erb = @slim
                                       >
Intuitive perception

Html with css:
<div class="highlight">
  this is some stuff
</div>
.highlight {
 border: 1px solid #f00 }

Haml with sass:
.highlight
  this is some stuff

.highlight
 border: 1px solid #f00
Now you can see that Haml is
          REALLY better than erb



You also can take a look for my blog graffzon.com

More Related Content

What's hot

Styling with CSS
Styling with CSSStyling with CSS
Styling with CSSMike Crabb
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?brynary
 
Simple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsSimple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsDavid Lucia
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Thinkful
 
Angular directive filter and routing
Angular directive filter and routingAngular directive filter and routing
Angular directive filter and routingjagriti srivastava
 
Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011rivierarb
 
Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2DanWooster1
 
Story Driven Development With Cucumber
Story Driven Development With CucumberStory Driven Development With Cucumber
Story Driven Development With CucumberSean Cribbs
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulationborkweb
 
Coder Presentation
Coder  PresentationCoder  Presentation
Coder PresentationDoug Green
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript IntroductionJainul Musani
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5jakemallory
 

What's hot (19)

9. lower in Symfony 4
9. lower in Symfony 49. lower in Symfony 4
9. lower in Symfony 4
 
HTML 5 Basics Part One
HTML 5 Basics Part OneHTML 5 Basics Part One
HTML 5 Basics Part One
 
Java script
Java scriptJava script
Java script
 
Styling with CSS
Styling with CSSStyling with CSS
Styling with CSS
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
7. copy2 in Symfony 4
7. copy2 in Symfony 47. copy2 in Symfony 4
7. copy2 in Symfony 4
 
JavaScript - Part-1
JavaScript - Part-1JavaScript - Part-1
JavaScript - Part-1
 
Merb jQuery
Merb jQueryMerb jQuery
Merb jQuery
 
Simple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsSimple Markdown with Ecto and Protocols
Simple Markdown with Ecto and Protocols
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
 
Angular directive filter and routing
Angular directive filter and routingAngular directive filter and routing
Angular directive filter and routing
 
Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011
 
Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2
 
Story Driven Development With Cucumber
Story Driven Development With CucumberStory Driven Development With Cucumber
Story Driven Development With Cucumber
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 
Coder Presentation
Coder  PresentationCoder  Presentation
Coder Presentation
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript Introduction
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5
 

Viewers also liked

Facebook for public health - NPIN
Facebook for public health - NPINFacebook for public health - NPIN
Facebook for public health - NPINGiuseppe Fattori
 
3.typing and advanced constructs
3.typing and advanced constructs3.typing and advanced constructs
3.typing and advanced constructsGabriel Hopmans
 
Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12Mightybytes
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluationBillysmedia
 
Saa s案例分析01
Saa s案例分析01Saa s案例分析01
Saa s案例分析01shaoshao11
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2ian11644
 
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...Elías Urrejola
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluationBillysmedia
 
20121204 are your lights on?
20121204 are your lights on?20121204 are your lights on?
20121204 are your lights on?jasonmel
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2ian11644
 
Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01Frost & Sullivan
 
Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13Jeffrey Zinn
 

Viewers also liked (20)

Facebook for public health - NPIN
Facebook for public health - NPINFacebook for public health - NPIN
Facebook for public health - NPIN
 
2.tao of topic maps
2.tao of topic maps2.tao of topic maps
2.tao of topic maps
 
3.typing and advanced constructs
3.typing and advanced constructs3.typing and advanced constructs
3.typing and advanced constructs
 
Eurovegas
EurovegasEurovegas
Eurovegas
 
MAN2012
MAN2012MAN2012
MAN2012
 
Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluation
 
Saa s案例分析01
Saa s案例分析01Saa s案例分析01
Saa s案例分析01
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2
 
Pertemuan 7
Pertemuan 7Pertemuan 7
Pertemuan 7
 
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluation
 
6. analisis jaringan
6. analisis jaringan6. analisis jaringan
6. analisis jaringan
 
20121204 are your lights on?
20121204 are your lights on?20121204 are your lights on?
20121204 are your lights on?
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2
 
Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01
 
Ragged school
Ragged schoolRagged school
Ragged school
 
Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13
 
Body parts
Body partsBody parts
Body parts
 
Pertemuan 8
Pertemuan 8Pertemuan 8
Pertemuan 8
 

Similar to Haml. New HTML? (RU)

AEM Sightly Template Language
AEM Sightly Template LanguageAEM Sightly Template Language
AEM Sightly Template LanguageGabriel Walt
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Ted Kulp
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2RORLAB
 
Clean separation
Clean separationClean separation
Clean separationatorreno
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用LearningTech
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2Rory Gianni
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the TrenchesXavier Noria
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/jsKnoldus Inc.
 
Rails antipattern-public
Rails antipattern-publicRails antipattern-public
Rails antipattern-publicChul Ju Hong
 
Rails antipatterns
Rails antipatternsRails antipatterns
Rails antipatternsChul Ju Hong
 
Rails for Beginners - Le Wagon
Rails for Beginners - Le WagonRails for Beginners - Le Wagon
Rails for Beginners - Le WagonAlex Benoit
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress WebsitesKyle Cearley
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Pedro Cunha
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js FundamentalsMark
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsMark
 

Similar to Haml. New HTML? (RU) (20)

AEM Sightly Template Language
AEM Sightly Template LanguageAEM Sightly Template Language
AEM Sightly Template Language
 
The Rails Way
The Rails WayThe Rails Way
The Rails Way
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2
 
Clean separation
Clean separationClean separation
Clean separation
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the Trenches
 
SEO for Developers
SEO for DevelopersSEO for Developers
SEO for Developers
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Rails antipattern-public
Rails antipattern-publicRails antipattern-public
Rails antipattern-public
 
Rails antipatterns
Rails antipatternsRails antipatterns
Rails antipatterns
 
Rails for Beginners - Le Wagon
Rails for Beginners - Le WagonRails for Beginners - Le Wagon
Rails for Beginners - Le Wagon
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11
 
Php
PhpPhp
Php
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
 
Intro to Haml
Intro to HamlIntro to Haml
Intro to Haml
 

More from Kirill Zonov

AWS X-Ray introduction and my experience
AWS X-Ray introduction and my experienceAWS X-Ray introduction and my experience
AWS X-Ray introduction and my experienceKirill Zonov
 
Kubernetes and Helm 101
Kubernetes and Helm 101Kubernetes and Helm 101
Kubernetes and Helm 101Kirill Zonov
 
IBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interfaceIBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interfaceKirill Zonov
 
DevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshopDevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshopKirill Zonov
 
Go for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B MeetupGo for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B MeetupKirill Zonov
 
Ruby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it againRuby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it againKirill Zonov
 
Haskell. Getting started (RU)
Haskell. Getting started (RU)Haskell. Getting started (RU)
Haskell. Getting started (RU)Kirill Zonov
 

More from Kirill Zonov (7)

AWS X-Ray introduction and my experience
AWS X-Ray introduction and my experienceAWS X-Ray introduction and my experience
AWS X-Ray introduction and my experience
 
Kubernetes and Helm 101
Kubernetes and Helm 101Kubernetes and Helm 101
Kubernetes and Helm 101
 
IBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interfaceIBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interface
 
DevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshopDevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshop
 
Go for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B MeetupGo for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B Meetup
 
Ruby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it againRuby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it again
 
Haskell. Getting started (RU)
Haskell. Getting started (RU)Haskell. Getting started (RU)
Haskell. Getting started (RU)
 

Recently uploaded

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Haml. New HTML? (RU)

  • 2. From ERB to Haml (Step 1) <div class="offering"> <div class="name"> <%= offering.name %> </div> <div class="symbol"> <%= offering.symbol %> </div> <div class="last_price"> <%= number_to_currency offering.last_price %> </div> <div class="last_traded_at"> <%= last_trade_at.to_formatted_s(:short) %> </div> <div class="actions"> <%= link_to "buy", offering_new_bid_path(offering) %> <% if offering.owners.find_by_user_id(session[:uid]) %> <%= link_to "sell", offering_new_ask_path(offering) %> <% end %> </div> </div>
  • 3. From ERB to Haml (Step 2) <div class="offering"> <div class="name"> <%= offering.name %> <div class="symbol"> <%= offering.symbol %> <div class="last_price"> <%= number_to_currency offering.last_price %> <div class="last_traded_at"> <%= last_trade_at.to_formatted_s(:short) %> <div class="actions"> <%= link_to "buy", offering_new_bid_path(offering) %> <% if offering.owners.find_by_user_id(session[:uid]) %> <%= link_to "sell", offering_new_ask_path(offering) %>
  • 4. From ERB to Haml (Step 3) .offering .name = offering.name .symbol = offering.symbol .last_price = number_to_currency offering.last_price .last_traded_at = last_trade_at.to_formatted_s(:short) .actions = link_to "buy", offering_new_bid_path(offering) - if offering.owners.find_by_user_id(session[:uid]) = link_to "sell", offering_new_ask_path(offering)
  • 5. Main ideas of Haml Markup should: ● be beautiful ● be clean ● be sensible ● follow the rules
  • 6. Rules of indentations .some_div line one line two <div class='some_div'> line one line two </div> <div class='some_div_two'> line one </div> .some_div_two line two line one line two If we try that: %h1 test work? (<h1> test work? </h1> ) Immediately we take error: Illegal nesting: content can't be both given on the same line as %h1 and nested within it.
  • 7. Size of code (erb) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> <%= configatron.app_name %> - <%= yield(:title) || 'Home' %> </title> <%= stylesheet_link_tag :flutie, 'application' %> <%= javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet' %> <%= csrf_meta_tag %> <%= yield(:head) %> <%= yield :javascript %> </head> <body> <div class="content"> <%= render 'layouts/navigation' %> <hr /> <%= render 'layouts/messages' %> <% if show_title? %> <h1> <%= yield(:title) %> </h1> <% end %> <%= yield %> </div> </body> </html>
  • 8. Size of code (haml) !!! %html %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title #{configatron.app_name} - #{yield(:title) || 'Home'} = stylesheet_link_tag :flutie, 'application' = javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet' = csrf_meta_tag = yield(:head) = yield :javascript %body .content = render 'layouts/navigation' %hr = render 'layouts/messages' %h1=yield(:title) if show_title? = yield
  • 9. No need for words ;)
  • 10. Any problems with haml? ● Perfomance problems ● Need for retraining
  • 11. Perfomance Haml - 0.00033s ERB - 0.000222s Slim - 0.000254s Код: Haml ERB Slim %h1 Haml#index %p Find me in <h1>Erb#index</h1> <p>Find me in h1 Haml#index p Find me in app/views/haml/index.html.erb =@haml app/views/erb/index.html.erb</p> <%= @erb % app/views/slim/index.html.erb = @slim >
  • 12. Intuitive perception Html with css: <div class="highlight"> this is some stuff </div> .highlight { border: 1px solid #f00 } Haml with sass: .highlight this is some stuff .highlight border: 1px solid #f00
  • 13. Now you can see that Haml is REALLY better than erb You also can take a look for my blog graffzon.com