HAML Cheat Sheet by J Lee (Specialbrand) Via Cheatography.Com/395/Cs/188

Total Page:16

File Type:pdf, Size:1020Kb

HAML Cheat Sheet by J Lee (Specialbrand) Via Cheatography.Com/395/Cs/188 HAML Cheat Sheet by J Lee (specialbrand) via cheatography.com/395/cs/188/ Doctype Elements Class and ID !!! <!DOCTYPE html PUBLIC "-//W3C//DTD %p %div#things XHTML 1.0 Transitional//EN" A paragraph %span#rice Chicken Fried "http://www.w3.org/TR/xhtml1/DTD/xhtml1- %strong bold %p.beans{ :food => 'true' } The magical fruit transitional.dtd"> %h1.class.otherclass#id La La La !!! 5 <!DOCTYPE html> is compiled to: <p>A paragraph <strong>bold</strong></p> is compiled to: !!! Strict <!DOCTYPE html PUBLIC "-//W3C//DTD <div id='things'> XHTML 1.0 Strict//EN" Attributes <span id='rice'>Chicken Fried</span> "http://www.w3.org/TR/xhtml1/DTD/xhtml1- <p class='beans' food='true'>The magical fruit</p> strict.dtd"> %html{:xmlns => "http://www.w3.org/1999/xhtml", <h1 class='class otherclass' id='id'>La La La</h1> "xml:lang" => "en", :lang => "en"} !!! <!DOCTYPE html PUBLIC "-//W3C//DTD </div> Frameset XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- is compiled to: Implicit Div Elements frameset.dtd"> <html xmlns='http://www.w3.org/1999/xhtml' xml:la ng='en' lang='en'></html> #collection .item Filters Self-Closing Tags .description What a cool item! %p %br :markdown is compiled to: %meta{'http-equiv' => 'Content-Type', :content => # Heading <div id='collection'> 'text/html'} Hello, *World* <div class='item'> <div class='description'>What a cool item!</div> is compiled to: is compiled to: </div> <br /> <p> </div> <h1>Heading</h1> <meta http-equiv='Content-Type' content='text/html' <p>Hello, <em>World</em></p> /> Comments </p> Escaping HTML HTML Comments: / Some Filters Available To Use &= "I like cheese and crackers" %peanutbutterjelly :plain Does not parse the filtered text. This is / This is the peanutbutterjelly element compiles to: useful for large blocks of text without HTML I like sandwiches! tags, when you don’t want lines starting I like cheese &ampamp; crackers with . or - to be parsed. is compiled to: :javas Surrounds the filtered text with <script> and <peanutbutterjelly> cript CDATA tags. Useful for including inline <!-- This is the peanutbutterjelly ellement --> Javascript. I like sandwiches! </peanutbutterjelly> :css Surrounds the filtered text with <style> and CDATA tags. Useful for including inline Haml Comments: -# CSS. %p foo :sass Parses the filtered text with Sass to produce -# This is a comment CSS output. %p bar :textile Parses the filtered text with Textile. is compiled to: :makuru Parses the filtered text with Maruku, which <p>foo</p> has some non-standard extensions to <p>bar</p> Markdown. Cheatographer Cheat Sheet Sponsor J Lee (specialbrand) This cheat sheet was published on 5th January, Envoy, for simple and effective bug management. cheatography.com/specialbrand/ 2012 and was last updated on 5th January, 2012. Try it free! www.specialbrand.net http://www.envoyapp.com.
Recommended publications
  • Modern Web Application Frameworks
    MASARYKOVA UNIVERZITA FAKULTA INFORMATIKY Û¡¢£¤¥¦§¨ª«¬­Æ°±²³´µ·¸¹º»¼½¾¿Ý Modern Web Application Frameworks MASTER’S THESIS Bc. Jan Pater Brno, autumn 2015 Declaration Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or ex- cerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Bc. Jan Pater Advisor: doc. RNDr. Petr Sojka, Ph.D. i Abstract The aim of this paper was the analysis of major web application frameworks and the design and implementation of applications for website content ma- nagement of Laboratory of Multimedia Electronic Applications and Film festival organized by Faculty of Informatics. The paper introduces readers into web application development problematic and focuses on characte- ristics and specifics of ten selected modern web application frameworks, which were described and compared on the basis of relevant criteria. Practi- cal part of the paper includes the selection of a suitable framework for im- plementation of both applications and describes their design, development process and deployment within the laboratory. ii Keywords Web application, Framework, PHP,Java, Ruby, Python, Laravel, Nette, Phal- con, Rails, Padrino, Django, Flask, Grails, Vaadin, Play, LEMMA, Film fes- tival iii Acknowledgement I would like to show my gratitude to my supervisor doc. RNDr. Petr So- jka, Ph.D. for his advice and comments on this thesis as well as to RNDr. Lukáš Hejtmánek, Ph.D. for his assistance with application deployment and server setup. Many thanks also go to OndˇrejTom for his valuable help and advice during application development.
    [Show full text]
  • Managing Data Constraints in Database-Backed Web Applications
    Managing data constraints in database-backed web applications Junwen Yang Utsav Sethi Cong Yan University of Chicago, USA University of Chicago, USA University of Washington, USA [email protected] [email protected] [email protected] Alvin Cheung Shan Lu University of California, Berkeley University of Chicago, USA USA [email protected] [email protected] ABSTRACT Database-backed web applications manipulate large amounts of … <input value=‘title’ pattern=‘.+’ title=‘invalid title’/> persistent data, and such applications often contain constraints … that restrict data length, data value, and other data properties. Such constraints are critical in ensuring the reliability and usability of Field Type Null Default … these applications. In this paper, we present a comprehensive study on where data constraints are expressed, what they are about, how title varchar(30) NO NULL … often they evolve, and how their violations are handled. The re- sults show that developers struggle with maintaining consistent … data constraints and checking them across different components validates_length_of : title, maximum: 60, message: ‘title is too long’ Mysql::Error and versions of their web applications, leading to various prob- … lems. Guided by our study, we developed checking tools and API enhancements that can automatically detect such problems and Figure 1: Crossstack data constraints improve the quality of such applications. 1 INTRODUCTION 60 characters)” error; finally, she tried a title a little shorter than60 1.1 Motivation characters, but the web page then crashed with all the filled content Constraints are often associated with data used in software. These lost with some unreadable database error displayed. range from describing the expected length, value, uniqueness, and It turned out that different constraints were specified for the other properties of the stored data.
    [Show full text]
  • AN INTRODUCTION by Enrique Canals / @Ecanals ENRIQUE CANALS
    THE BEAUTY OF CSS PRE-PROCESSORS: AN INTRODUCTION by Enrique Canals / @ecanals ENRIQUE CANALS Software Developer @ The Hybrid Group Currently working with Sphero, creating cool things for connecting robots to the internet Worked on several interesting web projects with Pebble Current maintainer of the TextMate SCSS Bundle for syntax highlighting with support for Atom and Sublime @ecanals | www.enriquecanals.com WHAT WE'RE GOING TO COVER IN THIS SESSION PART 1 CSS basics and shortcomings What are CSS pre-processors How pre-processors work and don't work PART 2 Which one do I use? (Sass, Less, Stylus) Workflow Integration Using pre-processors in WordPress theme development PART 1 CSS BASICS AND SHORTCOMINGS BASIC CSS SYNTAX This is the CSS you're used to. html, body { width: 100%; height: 100%; overflow: hidden; } body { background-color: #fff; color: #000; line-height: 1; position: relative; } Simple enough. NOW SOMETHING A LITTLE MORE COMPLEX: .reveal.slide section, .reveal.linear section { -webkit-backface-visibility: hidden; backface-visibility: hidden; } .reveal .slides > section[data-transition=slide].past, .reveal.slide .slides > section:not([data-transition] -webkit-transform: translate(-150%, 0); -ms-transform: translate(-150%, 0); transform: translate(-150%, 0); } .reveal .slides > section[data-transition=slide].future, .reveal.slide .slides > section:not([data-transition] -webkit-transform: translate(150%, 0); -ms-transform: translate(150%, 0); transform: translate(150%, 0); } .reveal .slides > section > section[data-transition=slide].past, .reveal.slide .slides > section > section -webkit-transform: translate(0, -150%); -ms-transform: translate(0, -150%); transform: translate(0, -150%); } .reveal .slides > section > section[data-transition=slide].future, .reveal.slide .slides > section > section -webkit-transform: translate(0, 150%); -ms-transform: translate(0, 150%); transform: translate(0, 150%); } You can see how this get's ugly fast.
    [Show full text]
  • Ruby Best Practices.Pdf
    Ruby Best Practices Ruby Best Practices Gregory Brown foreword by Yukihiro “Matz” Matsumoto Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Ruby Best Practices by Gregory Brown Copyright © 2009 Gregory Brown. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Editor: Mike Loukides Indexer: Ellen Troutman Zaig Production Editor: Sarah Schneider Cover Designer: Karen Montgomery Copyeditor: Nancy Kotary Interior Designer: David Futato Proofreader: Sada Preisch Illustrator: Robert Romano Printing History: June 2009: First Edition. O’Reilly and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Ruby Best Practices, the image of a green crab, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. In March 2010, this work will be released under the Creative Commons Attribution- Noncommercial-Share Alike 3.0 License.
    [Show full text]
  • View-Centric Performance Optimization for Database-Backed Web Applications
    View-Centric Performance Optimization for Database-Backed Web Applications Junwen Yang1, Cong Yan2, Chengcheng Wan1, Shan Lu1, Alvin Cheung2 1University of Chicago, junwen, cwan, [email protected] 2University of Washington, congy, [email protected] Abstract—Web developers face the stringent task of designing … informative web pages while keeping the page-load time low. <p> … This task has become increasingly challenging as most web <%= @active_projects … > contents are now generated by processing ever-growing amount … </p> of user data stored in back-end databases. It is difficult for developers to understand the cost of generating every web-page … element, not to mention explore and pick the web design with @active_projects = user.projects.active the best trade-off between performance and functionality. In this … paper, we present Panorama, a view-centric and database-aware development environment for web developers. Using database- aware program analysis and novel IDE design, Panorama pro- Fig. 1: Performance understanding challenge vides developers with intuitive information about the cost and the performance-enhancing opportunities behind every HTML file sidebar.html.erb, which produces this sidebar, renders element, as well as suggesting various global code refactorings these projects based on a Ruby variable @active projects that enable developers to easily explore a wide spectrum of embedded in the HTML file; this variable is computed performance and functionality trade-offs. in a controller Ruby file todos controller.rb through a seemingly straightforward assignment @active projects = I. INTRODUCTION user.projects.active. It turns out that this code actually A. Motivation retrieves objects stored in a database, and is translated into High-quality web applications need to provide both good a SQL query by the Rails framework at run time.
    [Show full text]
  • Mobile Site Rewrite
    Mobile Site Rewrite Patrick Reilly — Senior Developer Mobile Wikimedia Foundation Current implementation ● Ruby based mobile gateway utilizing Merb Process: ● A request comes in from a mobile browser ● The request generates a Device object in merb/extensions/request_extension.rb ● The Device object picks a format in Device#format_name ● Any method_missing that Device receives is looked up in the format specification ● The formats are specified in config/formats.yml ● An Article is fetched for that device ● First, the article figures out what kind of parser needed to be run on the page It then generates a key with that parser type. ● It then checks to see if that has been cached ● If it is not cached, it grabs scrapes the Wikipedia page and processes it with some /app/models/parsers/* class ● If it is cached, it returns that cached object ● The layout is generated with the returned Article#html ● The device format is used heavily here (aka, "= current_device.stylesheet_name") ● An "app/views/layouts/search#{format}.html.haml" file is rendered in the search area ● Changes in the search box and CSS fields are the biggest difference between formats Mobile site rewritten in PHP ● Having the site in Ruby causes a number of headaches (for code review, code deployment, and server maintenance) given Wikimedia's mostly PHP-based infrastructure. Rewrite rationale ● Puts the code in our code repo rather than on github ● Easier to review code in a language that most Wikimedia/MediaWiki developers are already using (PHP, instead of Ruby) ● Easier on
    [Show full text]
  • Brno University of Technology a Converter
    BRNO UNIVERSITY OF TECHNOLOGY VYSOKÉ UČENÍ TECHNICKÉ V BRNĚ FACULTY OF INFORMATION TECHNOLOGY DEPARTMENT OF INTELLIGENT SYSTEMS FAKULTA INFORMAČNÍCH TECHNOLOGIÍ ÚSTAV INTELIGENTNÍCH SYSTÉMŮ A CONVERTER BETWEEN THE LESS AND SASS STYLESHEET FORMATS PŘEKLADAČ MEZI FORMÁTY LESS A SASS BACHELOR’S THESIS BAKALÁŘSKÁ PRÁCE AUTHOR ATTILA VEČEREK AUTOR PRÁCE SUPERVISOR Prof. Ing. TOMÁŠ VOJNAR, Ph.D. VEDOUCÍ PRÁCE BRNO 2016 Abstract The aim of this thesis is to research the differences between the CSS preprocessor languages, namely Less and Sass, and find applicable transformation methods to implement a converter between their dynamic stylesheet formats. A general introduction to the concept of CSS preprocessors is provided first, which is followed by a thorough description of the Lessand Sass language features. In addition to this, all the discovered differences are stated and illustrative examples of the invented conversion methods are provided in this work. This is followed by the description of the design and implementation of the proposed converter. As a part of the contribution of this thesis, a CSS comparison tool based on abstract syntax tree transformation has also been developed. Its design is described along the testing procedure used to verify the invented conversion methods. The last part of the work summerizes the achieved results and the future directions of the converter. Abstrakt Cílem této bakalářské práce je výzkum rozdílů mezi CSS preprocesorovými jazyky, jmen- ovitě Less a Sass, a nalezení použitelných transormačních metod k implementaci překladače mezi jejich formáty. Nejprve je předložen koncept CSS preprocesorů a následuje detailní popis vlastností jazyků Less a Sass. V této práci jsou uvedené všechny zjištěné rozdíly, a pak jsou představeny nové konverzní metody s demonstrativními příklady.
    [Show full text]
  • HAML Cheat Sheet by Specialbrand
    HAML Cheat Sheet by J Lee (specialbrand) via cheatography.com/395/cs/188/ Doctype Elements Implicit Div Elements !!! <!DO​ CTYPE html PUBLIC "-​ %p #collec​ tion //W​ 3C/​ /DTD XHTML 1.0 ​ A paragraph ​ .item Transit​ ion​ al/​ /EN​ " ​ %​ strong bold ​ ​ ​ .des​ cri​ ption What a cool item! "h​ ttp​ ://​ www​ .w3​ .or​ g/T​ R/x​ htm​ l1/​ DTD​ / is compiled to: is compiled to: xh​ tml​ 1-t​ ran​ sit​ ion​ al.dtd​ "> <p>A paragraph <str​ ong​ >bo​ ld<​ /st​ ron​ g><​ /p> <div id='col​ lec​ tio​ n'> !!! 5 <!DO​ CTYPE html> ​ <​ div class='​ ite​ m'> Attributes ​ ​ ​ <​ div class='​ des​ cri​ pti​ on'​ >What a cool item! !!! Strict <!DO​ CTYPE html PUBLIC "-​ </​ div​ > //W​ 3C/​ /DTD XHTML 1.0 ​ %html{:xmlns => ​ <​ /di​ v> Strict/​ /EN​ " ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ "http://www.w3.org/1999/xhtml", "xml:lang" => </di​ v> "h​ ttp​ ://​ www​ .w3​ .or​ g/T​ R/x​ htm​ l1/​ DTD​ / "e​ n", :lang => "e​ n"} xh​ tml​ 1-s​ tri​ ct.dtd​ "> is compiled to: Comments !!! <!DO​ CTYPE html PUBLIC "-​ <html xmlns='​ htt​ p:/​ /ww​ w.w3​ .or​ g/​ 199​ 9/x​ html' Frameset //W​ 3C/​ /DTD XHTML 1.0 xml:lan​ g='en' lang='e​ n'>​ </h​ tml​ > HTML Comments: / Framese​ t//​ EN"​ %peanut​ but​ ter​ jelly "h​ ttp​ ://​ www​ .w3​ .or​ g/T​ R/x​ htm​ l1/​ DTD​ / Self-Cl​ osing Tags ​ / This is the peanutb​ utt​ erj​ elly element xh​ tml​ 1-f​ ram​ ese​ t.dt​ d"​ > ​ I like sandwic​ hes! %br is compiled to: %meta{'​ htt​ p-e​ quiv' => 'Conten​ t-T​ ype', :content Filters <pea​ nut​ but​ ter​ jel​ ly> => 'text/h​ tml'} ​ <​ !-- This is the peanutb​ utt​ erj​ elly ellement
    [Show full text]
  • Flycheck Release 32-Cvs
    Flycheck Release 32-cvs Aug 25, 2021 Contents 1 Try out 3 2 The User Guide 5 2.1 Installation................................................5 2.2 Quickstart................................................7 2.3 Troubleshooting.............................................8 2.4 Check buffers............................................... 12 2.5 Syntax checkers............................................. 14 2.6 See errors in buffers........................................... 18 2.7 List all errors............................................... 22 2.8 Interact with errors............................................ 24 2.9 Flycheck versus Flymake........................................ 27 3 The Community Guide 33 3.1 Flycheck Code of Conduct........................................ 33 3.2 Recommended extensions........................................ 34 3.3 Get help................................................. 37 3.4 People.................................................. 37 4 The Developer Guide 45 4.1 Developer’s Guide............................................ 45 5 The Contributor Guide 51 5.1 Contributor’s Guide........................................... 51 5.2 Style Guide................................................ 54 5.3 Maintainer’s Guide............................................ 57 6 Indices and Tables 63 6.1 Supported Languages.......................................... 63 6.2 Glossary................................................. 85 6.3 Changes................................................. 85 7 Licensing 93 7.1 Flycheck
    [Show full text]
  • Application Developer – Ruby on Rails (Remote) Digsite®
    Application Developer – Ruby on Rails (remote) Digsite® www.digsite.com Great technology is built by people with a true passion for innovation. Do you love applying test driven development to build high quality, scalable software? Are you a full stack Ruby on Rails developer with strong foundational skills and the flexibility to take on a variety of responsibilities? If this sounds like you, read on! Responsibilities Your primary focus will be working on a Rails application with a Postgresql database. You should be comfortable writing object-oriented code and working with the full stack. • Write and maintain readable, reusable and reliable Ruby code • Integration of user-facing elements using HAML, ERB, and Coffeescript • Integrate with data stores using Postgres and Redis • Expand integrations with Google Natural Language and other outside integrations • Help maintain code quality, organization and automatization with the assistance of Code Climate • Work closely with team to ensure quality user experiences and bug free releases Qualifications • Experience with Ruby on Rails, along with other common libraries such as RSpec and Sidekiq • Solid understandingof front-end technologies, such as JavaScript, HTML5, CSS3, and Coffeescript • Working knowledge of AWS / Elastic Beanstalk / NginX stack. Knowledge of Azure is a plus. • Strong understanding of object-oriented programming • Good understanding of server-side templating languages such as HAML, ERB and SLIM • Good understanding of server-side CSS preprocessors, we use SASS • Ability to engage in a TDD environment using RSpec • Proficient understanding of code versioning tools, we use Git and a standard Gitflow model • Previous experience in applying agile, test driven development • Exposure to .NET development a plus Requirements • BS in Computer Science, or other technical degree plus CodeCamp • 5+ years experience in developments with Ruby on Rails • US Citizen or permanent US work authorization required • High speed internet and ability to participate in video calls.
    [Show full text]
  • Warehouse Management System in Ruby on Rails Framework on Cloud Computing Architecture
    366 Warehouse management system in Ruby on Rails framework on cloud computing architecture. Kamil Durski, Jan Murlewski, Dariusz Makowski, Bartosz Sakowicz Abstract – This article describes internet-based application During past few years a lot of web frameworks [1] for warehouse management written in Ruby with use of were created, most of them in PHP language – Zend Ruby on Rails framework and distributed as Software as a Framework, Kohana, CakePHP to name a few. They are very Service (SaaS) platform. This approach allows for great useful at what they do, however they are all limited by compatibility between operating systems as well as makes language itself, which, like most of popular tools, is struggling it possible to access application from all kind of devices – with backward compatibility and therefore does not even from standalone desktop computers up to tables and all support all of Object Oriented Programming paradigm. To kind of mobile devices. Example application was overcome this, some people dedicated to create web developed in Ruby on Rails version 2.3. frameworks in different programming languages. Out of those two become vastly popular – Django [2] in Python and Ruby Keywords –Warehouse Management, Ruby, Rails, SaaS on Rails [3] in Ruby. Ruby in Rails (short: Rails) is a framework with three I. INTRODUCTION basic principles: 1. Convection over Configuration guarantees short (if at all) configuration needed by application. These days Internet is the faster developing medium in 2. Do not Repeat Yourself (DRY) ensures that no piece the whole World. It is not only available via landline, but also of code should be repeated more then once.
    [Show full text]
  • Towards Left Duff S Mdbg Holt Winters Gai Incl Tax Drupal Fapi Icici
    jimportneoneo_clienterrorentitynotfoundrelatedtonoeneo_j_sdn neo_j_traversalcyperneo_jclientpy_neo_neo_jneo_jphpgraphesrelsjshelltraverserwritebatchtransactioneventhandlerbatchinsertereverymangraphenedbgraphdatabaseserviceneo_j_communityjconfigurationjserverstartnodenotintransactionexceptionrest_graphdbneographytransactionfailureexceptionrelationshipentityneo_j_ogmsdnwrappingneoserverbootstrappergraphrepositoryneo_j_graphdbnodeentityembeddedgraphdatabaseneo_jtemplate neo_j_spatialcypher_neo_jneo_j_cyphercypher_querynoe_jcypherneo_jrestclientpy_neoallshortestpathscypher_querieslinkuriousneoclipseexecutionresultbatch_importerwebadmingraphdatabasetimetreegraphawarerelatedtoviacypherqueryrecorelationshiptypespringrestgraphdatabaseflockdbneomodelneo_j_rbshortpathpersistable withindistancegraphdbneo_jneo_j_webadminmiddle_ground_betweenanormcypher materialised handaling hinted finds_nothingbulbsbulbflowrexprorexster cayleygremlintitandborient_dbaurelius tinkerpoptitan_cassandratitan_graph_dbtitan_graphorientdbtitan rexter enough_ram arangotinkerpop_gremlinpyorientlinkset arangodb_graphfoxxodocumentarangodborientjssails_orientdborientgraphexectedbaasbox spark_javarddrddsunpersist asigned aql fetchplanoriento bsonobjectpyspark_rddrddmatrixfactorizationmodelresultiterablemlibpushdownlineage transforamtionspark_rddpairrddreducebykeymappartitionstakeorderedrowmatrixpair_rddblockmanagerlinearregressionwithsgddstreamsencouter fieldtypes spark_dataframejavarddgroupbykeyorg_apache_spark_rddlabeledpointdatabricksaggregatebykeyjavasparkcontextsaveastextfilejavapairdstreamcombinebykeysparkcontext_textfilejavadstreammappartitionswithindexupdatestatebykeyreducebykeyandwindowrepartitioning
    [Show full text]