diff options
-rw-r--r-- | bash.html.markdown | 7 | ||||
-rw-r--r-- | haml.html.markdown | 52 | ||||
-rw-r--r-- | id-id/hq9+-id.html.markdown | 45 |
3 files changed, 95 insertions, 9 deletions
diff --git a/bash.html.markdown b/bash.html.markdown index 76710aa8..981d7a1e 100644 --- a/bash.html.markdown +++ b/bash.html.markdown @@ -15,6 +15,7 @@ contributors: - ["Leo Rudberg", "https://github.com/LOZORD"] - ["Betsy Lorton", "https://github.com/schbetsy"] - ["John Detter", "https://github.com/jdetter"] + - ["Harry Mumford-Turner", "https://github.com/harrymt"] filename: LearnBash.sh --- @@ -235,10 +236,8 @@ EOF python hello.py < "input.in" # pass input.in as input to the script python hello.py > "output.out" # redirect output from the script to output.out python hello.py 2> "error.err" # redirect error output to error.err -python hello.py > "output-and-error.log" 2>&1 # redirect both output and - # errors to output-and-error.log -python hello.py > /dev/null 2>&1 # redirect all output and errors to - # the black hole, /dev/null, i.e., no output +python hello.py > "output-and-error.log" 2>&1 # redirect both output and errors to output-and-error.log +python hello.py > /dev/null 2>&1 # redirect all output and errors to the black hole, /dev/null, i.e., no output # The output error will overwrite the file if it exists, # if you want to append instead, use ">>": python hello.py >> "output.out" 2>> "error.err" diff --git a/haml.html.markdown b/haml.html.markdown index 5dd4cb6d..bb8bdc54 100644 --- a/haml.html.markdown +++ b/haml.html.markdown @@ -3,6 +3,7 @@ language: haml filename: learnhaml.haml contributors: - ["Simon Neveu", "https://github.com/sneveu"] + - ["Vasiliy Petrov", "https://github.com/Saugardas"] --- Haml is a markup language predominantly used with Ruby that cleanly and simply describes the HTML of any web document without the use of inline code. It is a popular alternative to using Rails templating language (.erb) and allows you to embed Ruby code into your markup. @@ -11,7 +12,9 @@ It aims to reduce repetition in your markup by closing tags for you based on the You can also use Haml on a project independent of Ruby, by installing the Haml gem on your machine and using the command line to convert it to html. +```shell $ haml input_file.haml output_file.html +``` ```haml @@ -55,8 +58,17 @@ $ haml input_file.haml output_file.html </header> </body> -/ The div tag is the default element, so they can be written simply like this -.foo +/ + The div tag is the default element, so it can be omitted. + You can define only class/id using . or # + For example + +%div.my_class + %div#my_id + +/ Can be written +.my_class + #my_id / To add content to a tag, add the text directly after the declaration %h1 Headline copy @@ -97,6 +109,15 @@ $ haml input_file.haml output_file.html / To write data-attributes, use the :data key with its value as another hash %div{:data => {:attribute => 'foo'}} +/ For Ruby version 1.9 or higher you can use Ruby's new hash syntax +%div{ data: { attribute: 'foo' } } + +/ Also you can use HTML-style attribute syntax. +%a(href='#' title='bar') + +/ And both syntaxes together +%a(href='#'){ title: @my_class.title } + / ------------------------------------------- / Inserting Ruby @@ -120,7 +141,7 @@ $ haml input_file.haml output_file.html - books.shuffle.each_with_index do |book, index| %h1= book - if book do + - if book do %p This is a book / Adding ordered / unordered list @@ -166,12 +187,33 @@ $ haml input_file.haml output_file.html / ------------------------------------------- / - Use the colon to define Haml filters, one example of a filter you can - use is :javascript, which can be used for writing inline js + Filters pass the block to another filtering program and return the result in Haml + To use a filter, type a colon and the name of the filter + +/ Markdown filter +:markdown + # Header + Text **inside** the *block* + +/ The code above is compiled into +<h1>Header</h1> + +<p>Text <strong>inside</strong> the <em>block</em></p> + +/ Javascript filter :javascript console.log('This is inline <script>'); +/ is compiled into +<script> + console.log('This is inline <script>'); +</script> + +/ + There are many types of filters (:markdown, :javascript, :coffee, :css, :ruby and so on) + Also you can define your own filters using Haml::Filters + ``` ## Additional resources diff --git a/id-id/hq9+-id.html.markdown b/id-id/hq9+-id.html.markdown new file mode 100644 index 00000000..46abcf42 --- /dev/null +++ b/id-id/hq9+-id.html.markdown @@ -0,0 +1,45 @@ +--- +language: HQ9+ +filename: hq9+-id.html +contributors: + - ["Alexey Nazaroff", "https://github.com/rogaven"] +translators: + - ["Haydar Ali Ismail", "http://github.com/haydarai"] +lang: id-id +--- + +HQ9+ adalah bahasa pemrograman gurauan yang dibuat oleh Cliff Biffle. Bahasa +ini hanya memiliki empat perintah dan tidak memenuhi Turing-complete. + +``` +Hanya ada 4 perintah, masing-masing direpresentasikan oleh karakter berikut +H: mencetak "Hello, world!" +Q: mencetak kode sumber dari program ini (Quine) +9: mencetak lirik dari lagu "99 Bottles of Beer" ++: menambah nilai satu ke akumulator (nilai dari akumulator tidak dapat + diakses) +Karakter lain akan dihiraukan. + +Ok. Mari kita menulis beberapa program: + HQ9 + +Hasil: + Hello world! + HQ9 + +HQ9+ sangat sederhana, tetapi membuat anda bisa melakukan hal yang sangat sulit +dilakukan di bahasa lain. Sebagai contoh, berikut sebuah program yang +menciptakan tiga salinan dirinya sendiri ke layar: + QQQ + +Ini menghasilakn: + QQQ + QQQ + QQQ +``` + +Dan itu semuanya. Ada banyak interpreters untuk HQ9+. Kamu bisa menemukannya di +bawah + ++ [Salah satu interpreter online](https://almnet.de/esolang/hq9plus.php) ++ [Website resmi HQ9+](http://cliffle.com/esoterica/hq9plus.html) |