summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--amd.html.markdown9
-rw-r--r--c++.html.markdown2
-rw-r--r--common-lisp.html.markdown2
-rw-r--r--elixir.html.markdown35
-rw-r--r--fr-fr/brainfuck-fr.html.markdown87
-rw-r--r--fr-fr/markdown.html.markdown288
-rw-r--r--fr-fr/xml-fr.html.markdown3
-rw-r--r--haml.html.markdown155
-rw-r--r--haskell.html.markdown4
-rw-r--r--javascript.html.markdown23
-rw-r--r--matlab.html.markdown50
-rw-r--r--nl-nl/brainfuck-nl.html.markdown86
-rw-r--r--nl-nl/coffeescript-nl.html.markdown23
-rw-r--r--ocaml.html.markdown2
-rw-r--r--ru-ru/markdown-ru.html.markdown279
-rw-r--r--swift.html.markdown133
-rw-r--r--vi-vn/git-vi.html.markdown66
17 files changed, 1135 insertions, 112 deletions
diff --git a/amd.html.markdown b/amd.html.markdown
index 36210d03..b3237dc7 100644
--- a/amd.html.markdown
+++ b/amd.html.markdown
@@ -136,6 +136,7 @@ require(['jquery', 'coolLibFromBower', 'modules/someHelpers'], function($, coolL
});
```
`require.js`-based apps will usually have a single entry point (`main.js`) that is passed to the `require.js` script tag as a data-attribute. It will be automatically loaded and executed on pageload:
+
```html
<!DOCTYPE html>
<html>
@@ -155,13 +156,15 @@ Many people prefer using AMD for sane code organization during development, but
`require.js` comes with a script called `r.js` (that you will probably run in node.js, although Rhino is supported too) that can analyse your project's dependency graph, and build a single file containing all your modules (properly named), minified and ready for consumption.
Install it using `npm`:
-```sh
+```shell
$ npm install requirejs -g
```
+
Now you can feed it with a configuration file:
-```sh
+```shell
$ r.js -o app.build.js
```
+
For our above example the configuration might look like:
```javascript
/* file : app.build.js */
@@ -177,10 +180,12 @@ For our above example the configuration might look like:
}
})
```
+
To use the built file in production, simply swap `data-main`:
```html
<script src="require.js" data-main="app/main-built"></script>
```
+
An incredibly detailed [overview of build options](https://github.com/jrburke/r.js/blob/master/build/example.build.js) is available in the GitHub repo.
### Topics not covered in this tutorial
diff --git a/c++.html.markdown b/c++.html.markdown
index 50de5eff..9f357b08 100644
--- a/c++.html.markdown
+++ b/c++.html.markdown
@@ -305,7 +305,7 @@ void Dog::Dog()
// if you are modifying them or const reference if you are not.
void Dog::setName(const std::string& dogsName)
{
- name = doggie_name;
+ name = dogsName;
}
void Dog::setWeight(int dogsWeight)
diff --git a/common-lisp.html.markdown b/common-lisp.html.markdown
index 08134e35..c4ecb5e8 100644
--- a/common-lisp.html.markdown
+++ b/common-lisp.html.markdown
@@ -431,7 +431,7 @@ nil ; for false - and the empty list
:walked
(walker (1- n))))
-(walker) ; => :walked
+(walker 5) ; => :walked
;; Most of the time, we use DOLIST or LOOP
diff --git a/elixir.html.markdown b/elixir.html.markdown
index c0abc815..0a20e3df 100644
--- a/elixir.html.markdown
+++ b/elixir.html.markdown
@@ -2,6 +2,7 @@
language: elixir
contributors:
- ["Joao Marques", "http://github.com/mrshankly"]
+ - ["Dzianis Dashkevich", "https://github.com/dskecse"]
filename: learnelixir.ex
---
@@ -59,7 +60,7 @@ tail #=> [2,3]
# the tuples have different sizes.
# {a, b, c} = {1, 2} #=> ** (MatchError) no match of right hand side value: {1,2}
-# There's also binaries
+# There are also binaries
<<1,2,3>> # binary
# Strings and char lists
@@ -108,7 +109,7 @@ div(10, 2) #=> 5
# To get the division remainder use `rem`
rem(10, 3) #=> 1
-# There's also boolean operators: `or`, `and` and `not`.
+# There are also boolean operators: `or`, `and` and `not`.
# These operators expect a boolean as their first argument.
true and true #=> true
false or true #=> true
@@ -119,7 +120,6 @@ false or true #=> true
1 || true #=> 1
false && 1 #=> false
nil && 20 #=> nil
-
!true #=> false
# For comparisons we have: `==`, `!=`, `===`, `!==`, `<=`, `>=`, `<` and `>`
@@ -165,12 +165,12 @@ case {:one, :two} do
{:four, :five} ->
"This won't match"
{:one, x} ->
- "This will match and assign `x` to `:two`"
+ "This will match and bind `x` to `:two`"
_ ->
"This will match any value"
end
-# It's common practice to assign a value to `_` if we don't need it.
+# It's common to bind the value to `_` if we don't need it.
# For example, if only the head of a list matters to us:
[head | _] = [1,2,3]
head #=> 1
@@ -190,7 +190,7 @@ cond do
"But I will"
end
-# It is common to see a last condition equal to `true`, which will always match.
+# It is common to see the last condition equal to `true`, which will always match.
cond do
1 + 1 == 3 ->
"I will never be seen"
@@ -301,7 +301,7 @@ end
Recursion.sum_list([1,2,3], 0) #=> 6
# Elixir modules support attributes, there are built-in attributes and you
-# may also add custom attributes.
+# may also add custom ones.
defmodule MyMod do
@moduledoc """
This is a built-in attribute on a example module.
@@ -312,21 +312,24 @@ defmodule MyMod do
end
## ---------------------------
-## -- Records and Exceptions
+## -- Structs and Exceptions
## ---------------------------
-# Records are basically structures that allow you to associate a name with
-# a particular value.
-defrecord Person, name: nil, age: 0, height: 0
+# Structs are extensions on top of maps that bring default values,
+# compile-time guarantees and polymorphism into Elixir.
+defmodule Person do
+ defstruct name: nil, age: 0, height: 0
+end
-joe_info = Person.new(name: "Joe", age: 30, height: 180)
-#=> Person[name: "Joe", age: 30, height: 180]
+joe_info = %Person{ name: "Joe", age: 30, height: 180 }
+#=> %Person{age: 30, height: 180, name: "Joe"}
# Access the value of name
joe_info.name #=> "Joe"
# Update the value of age
-joe_info = joe_info.age(31) #=> Person[name: "Joe", age: 31, height: 180]
+older_joe_info = %{ joe_info | age: 31 }
+#=> %Person{age: 31, height: 180, name: "Joe"}
# The `try` block with the `rescue` keyword is used to handle exceptions
try do
@@ -394,5 +397,7 @@ self() #=> #PID<0.27.0>
* [Getting started guide](http://elixir-lang.org/getting_started/1.html) from [elixir webpage](http://elixir-lang.org)
* [Elixir Documentation](http://elixir-lang.org/docs/master/)
+* ["Programming Elixir"](https://pragprog.com/book/elixir/programming-elixir) by Dave Thomas
+* [Elixir Cheat Sheet](http://media.pragprog.com/titles/elixir/ElixirCheat.pdf)
* ["Learn You Some Erlang for Great Good!"](http://learnyousomeerlang.com/) by Fred Hebert
-* "Programming Erlang: Software for a Concurrent World" by Joe Armstrong
+* ["Programming Erlang: Software for a Concurrent World"](https://pragprog.com/book/jaerlang2/programming-erlang) by Joe Armstrong
diff --git a/fr-fr/brainfuck-fr.html.markdown b/fr-fr/brainfuck-fr.html.markdown
new file mode 100644
index 00000000..3882734d
--- /dev/null
+++ b/fr-fr/brainfuck-fr.html.markdown
@@ -0,0 +1,87 @@
+---
+language: brainfuck
+filename: learnbrainfuck-fr.bf
+contributors:
+ - ["Prajit Ramachandran", "http://prajitr.github.io/"]
+ - ["Mathias Bynens", "http://mathiasbynens.be/"]
+translators:
+ - ["Baptiste Fontaine", "http://bfontaine.net"]
+lang: fr-fr
+---
+
+Brainfuck (sans majuscule à part au début d’une phrase) est un langage
+Turing-complet extrêmement simple avec seulement 8 commandes.
+
+```
+Tout caractère en dehors de "><+-.,[]" (en dehors des guillements) est ignoré.
+
+Brainfuck est représenté par un tableau de 30 000 cellules initialisées à 0 et
+un pointeur de données pointant sur la cellule courante.
+
+Il y a huit commandes :
++ : Incrémente la valeur de la cellule courante de un.
+- : Décrémente la valeur de la cellule courante de un.
+> : Déplace le pointeur de données sur la cellule suivante (à droite).
+< : Déplace le pointeur de données sur la cellule précédente (à gauche).
+. : Affiche la valeur ASCII de la cellule courante (par ex. 65 = 'A').
+, : Lit un caractère et le place dans la cellule courante.
+[ : Si la valeur dans la cellule courante vaut 0, saute au ] correspondant.
+ Sinon, continue avec la commande suivante.
+] : Si la valeur dans la cellule courante vaut 0, continue avec la commande
+ suivante. Sinon, retourne au [ correspondant.
+
+[ et ] forment une boucle « tant que » (« while »). Ils doivent évidemment
+aller par paires.
+
+Regardons quelques programmes simples en brainfuck.
+
+++++++ [ > ++++++++++ < - ] > +++++ .
+
+Ce programme affiche la lettre 'A'. Il commence par incrémenter la première
+cellule à 6. Il entre ensuite dans une boucle et se déplace sur la seconde
+cellule. Il l’incrémente 10 fois, retourne sur la première cellule, et la
+décrémente. Cette boucle est exécutée 6 fois (ce qui correspond aux 6
+décrémentations de la première cellule pour la faire atteindre 0, ce qui fait
+sortir de la boucle).
+
+À ce moment-là, nous sommes sur la première cellule, qui a une valeur de 0,
+tandis que la seconde cellule a une valeur de 60. Nous nous déplaçons sur
+celle-ci, l’incrémentons 5 fois, pour une valeur de 65, et affichons sa valeur.
+En ASCII, 65 correspond à 'A' donc le programme affiche 'A' dans le terminal.
+
+, [ > + < - ] > .
+
+Ce programme lit un caractère sur l’entrée standard et le copie dans la
+première cellule. Il commence ensuite une boucle : il bouge sur la seconde
+cellule, incrémente sa valeur, retourne sur la première et décrémente sa
+valeur. Il continue jusqu’à ce que la valeur de la première cellule soit à 0,
+et que la seconde cellule contienne l’ancienne valeur de la première. Comme
+nous sommes sur la première cellule à la fin de la boucle, il bouge sur la
+seconde et affiche sa valeur en ASCII.
+
+Souvenez-vous que les espaces sont uniquement là pour favoriser la lisibilité,
+vous pourriez tout aussi aisément écrire le programme comme ceci :
+
+,[>+<-]>.
+
+Essayez et devinez ce que ce programme fait :
+
+,>,< [ > [ >+ >+ << -] >> [- << + >>] <<< -] >>
+
+Ce programme prend deux nombres en entrée, et les multiplie.
+
+Il commence par lire deux entrées, puis commence une boucle externe, qui a une
+condition sur la première cellule. Il bouge ensuite sur la seconde, et commence
+une boucle interne sur celle-ci, en incrémentant la troisième cellule. Il y a
+cependant un problème : à la fin de la boucle interne, la valeur de la seconde
+cellule est à zéro. Dans ce cas, la boucle interne ne fonctionnera pas une
+seconde fois. Pour régler le problème, nous incrémentons aussi la quatrième
+cellule, puis recopions sa valeur dans la seconde cellule.
+À la fin, la troisième cellule contient le résultat de la multiplication.
+```
+
+Et voilà ce qu’est le brainfuck. Pas très dur, hein ? Pour le fun, vous pouvez
+écrire vos propres programmes en brainfuck, ou écrire un interpréteur brainfuck
+dans un autre langage. L’interpréteur est relativement simple à implémenter,
+mais si vous êtes un masochiste, essayez d’écrire un interpréteur brainfuck en…
+brainfuck.
diff --git a/fr-fr/markdown.html.markdown b/fr-fr/markdown.html.markdown
new file mode 100644
index 00000000..e3ac5a92
--- /dev/null
+++ b/fr-fr/markdown.html.markdown
@@ -0,0 +1,288 @@
+---
+language: markdown
+contributors:
+- ["Andrei Curelaru", "http://www.infinidad.fr"]
+filename: markdown.md
+---
+
+Markdown a été créé par Jhon Gruber en 2004. Il se veut être d'une syntaxe
+facile à lire et à écrire, aisément convertible en HTML
+ (et beaucoup d'autres formats aussi à présent).
+
+Faites moi autant de retours que vous voulez! Sentez vous libre de "forker"
+et envoyer des pull request!
+
+
+```markdown
+<!-- Markdown est une sorte de cousin du HTML, si bien que tout document HTML
+est un document Markdown valide. Autrement dit, vous pouvez utiliser des
+balises HTML dans un fichier Markdown, comme la balise commentaire dans
+laquelle nous sommes à présent, car celle-ci ne sera pas affectée par
+le parser( analyseur syntaxique ) Markdown. -->
+
+<!-- Toutefois, si vous voulez créer un élément HTML dans un fichier Markdown,
+ vous ne pourrez pas utiliser du Markdown à l'intérieur de ce dernier. -->
+
+<!-- Le Markdown est implémenté de différentes manières, selon le parser.
+Ce guide va alors tenter de trier les fonctionnalités universelles de celles
+spécifiques à un parser. -->
+
+<!-- Headers ( En-têtes ) -->
+<!-- Vous pouvez facilement créer des éléments HTML <h1> à <h6> en précédant
+ le texte de votre futur titre par un ou plusieurs dièses ( # ), de un à six,
+ selon le niveau de titre souhaité. -->
+# Ceci est un <h1>
+## Ceci est un <h2>
+### Ceci est un <h3>
+#### Ceci est un <h4>
+##### Ceci est un <h5>
+###### Ceci est un <h6>
+
+<!--
+Markdown fournit également une façon alternative de marquer les h1 et h2
+-->
+
+Ceci est un h1
+=============
+
+Ceci est un h2
+-------------
+
+<!-- Styles basiques pour du texte -->
+<!-- On peut facilement rendre un texte "gras" ou "italique" en Markdown -->
+
+*Ce texte est en italique.*
+_Celui-ci aussi._
+
+**Ce texte est en gras.**
+__Celui-là aussi.__
+
+***Ce texte a les deux styles.***
+**_Pareil ici_**
+*__Et là!__*
+
+<!-- Dans le "Github Flavored Markdown", utilisé pour interpréter le Markdown
+sur Github, on a également le strikethrough ( texte barré ) : -->
+
+~~Ce texte est barré avec strikethrough.~~
+
+<!-- Les Paragraphes sont représentés par une ou plusieurs lignes de texte
+séparées par une ou plusieurs lignes vides. -->
+
+Ceci est un paragraphe. Là, je suis dans un paragraphe, facile non?
+
+Maintenant je suis dans le paragraphe 2.
+Je suis toujours dans le paragraphe 2!
+
+
+Puis là, eh oui, le paragraphe 3!
+
+<!--
+Si jamais vous souhaitez insérer une balise HTML <br />, vous pouvez ajouter
+un ou plusieurs espaces à la fin de votre paragraphe, et en commencer
+un nouveau.
+-->
+
+J'ai deux espaces vides à la fin (sélectionnez moi pour les voir).
+
+Bigre, il y a un <br /> au dessus de moi!
+
+<!-- Les 'Blocs de Citations' sont générés aisément, grâce au caractère > -->
+
+> Ceci est une superbe citation. Vous pouvez même
+> revenir à la ligne quand ça vous chante, et placer un `>`
+> devant chaque bout de ligne faisant partie
+> de la citation.
+> La taille ne compte pas^^ tant que chaque ligne commence par un `>`.
+
+> Vous pouvez aussi utiliser plus d'un niveau
+>> d'imbrication!
+> Classe et facile, pas vrai?
+
+<!-- les Listes -->
+<!-- les Listes non ordonnées sont marquées par des asterisques,
+signes plus ou signes moins. -->
+
+* Item
+* Item
+* Un autre item
+
+ou
+
++ Item
++ Item
++ Encore un item
+
+ou
+
+- Item
+- Item
+- Un dernier item
+
+<!-- les Listes Ordonnées sont générées via un nombre suivi d'un point -->
+
+1. Item un
+2. Item deux
+3. Item trois
+
+<!-- Vous pouvez même vous passer de tout numéroter, et Markdown générera
+les bons chiffres. Ceci dit, cette variante perd en clarté.-->
+
+1. Item un
+1. Item deux
+1. Item trois
+<!-- ( cette liste sera interprétée de la même façon que celle au dessus ) -->
+
+<!-- Vous pouvez également utiliser des sous-listes -->
+
+1. Item un
+2. Item deux
+3. Item trois
+* Sub-item
+* Sub-item
+4. Item quatre
+
+<!-- Il y a même des "listes de Taches". Elles génèrent des champs HTML
+de type checkbox. -->
+
+Les [ ] ci dessous, n'ayant pas de [ x ],
+deviendront des cases à cocher HTML non-cochées.
+
+- [ ] Première tache à réaliser.
+- [ ] Une autre chose à faire.
+La case suivante sera une case à cocher HTML cochée.
+- [x] Ça ... c'est fait!
+
+<!-- les Blocs de Code -->
+<!-- Pour marquer du texte comme étant du code, il suffit de commencer
+chaque ligne en tapant 4 espaces (ou un Tab) -->
+
+ echo "Ça, c'est du Code!";
+ var Ça = "aussi !";
+
+<!-- L'indentation par tab ou série de quatre espaces
+fonctionne aussi à l'intérieur du bloc de code -->
+
+ my_array.each do |item|
+ puts item
+ end
+
+<!-- Des bouts de code en mode 'inline' s'ajoutent en les entourant de ` -->
+
+La fonction `run()` ne vous oblige pas à aller courir!
+
+<!-- Via Github Flavored Markdown, vous pouvez utiliser
+des syntaxes spécifiques -->
+
+\`\`\`ruby
+<!-- mais enlevez les backslashes quand vous faites ça,
+gardez juste ```ruby ( ou nom de la synatxe correspondant à votre code )-->
+def foobar
+puts "Hello world!"
+end
+\`\`\` <!-- pareil, pas de backslashes, juste ``` en guise de fin -->
+
+<-- Pas besoin d'indentation pour le code juste au dessus, de plus, Github
+va utiliser une coloration syntaxique pour le langage indiqué après les ``` -->
+
+<!-- Ligne Horizontale (<hr />) -->
+<!-- Pour en insérer une, utilisez trois ou plusieurs astérisques ou tirets,
+avec ou sans espaces entre chaque un. -->
+
+***
+---
+- - -
+****************
+
+<!-- Liens -->
+<!-- Une des fonctionnalités sympathiques du Markdown est la facilité
+d'ajouter des liens. Le texte du lien entre [ ], l'url entre ( ),
+et voilà l'travail.
+-->
+
+[Clic moi!](http://test.com/)
+
+<!--
+Pour ajouter un attribut Title, collez le entre guillemets, avec le lien.
+-->
+
+[Clic moi!](http://test.com/ "Lien vers Test.com")
+
+<!-- les Liens Relatifs marchent aussi -->
+
+[En avant la musique](/music/).
+
+<!-- Les liens façon "références" sont eux aussi disponibles en Markdown -->
+
+[Cliquez ici][link1] pour plus d'information!
+[Regardez aussi par ici][foobar] si vous voulez.
+
+[link1]: http://test.com/ "Cool!"
+[foobar]: http://foobar.biz/ "Alright!"
+
+<!-- Le titre peut aussi être entouré de guillemets simples,
+entre parenthèses ou absent. Les références peuvent être placées
+un peu où vous voulez dans le document, et les identifiants
+(link1, foobar, ...) quoi que ce soit tant qu'ils sont uniques -->
+
+<!-- Il y a également le "nommage implicite" qui transforme le texte du lien
+ en identifiant -->
+
+[Ceci][] est un lien.
+
+[ceci]: http://ceciestunlien.com/
+
+<!-- mais ce n'est pas beaucoup utilisé. -->
+
+<!-- Images -->
+<!-- Pour les images, la syntaxe est identique aux liens, sauf que précédée
+ d'un point d'exclamation! -->
+
+![Attribut ALT de l'image](http://imgur.com/monimage.jpg "Titre optionnel")
+
+<!-- Là aussi, on peut utiliser le mode "références" -->
+
+![Ceci est l'attribut ALT de l'image][monimage]
+
+[monimage]: relative/urls/cool/image.jpg "si vous voulez un titre, c'est ici."
+
+<!-- Divers -->
+<!-- Liens Automatiques -->
+
+<http://testwebsite.com/> est équivalent à :
+[http://testwebsite.com/](http://testwebsite.com/)
+
+<!-- Liens Automatiques pour emails -->
+
+<foo@bar.com>
+
+<!-- Escaping -->
+Il suffit de précéder les caractères spécifiques à ignorer par des backslash \
+
+Pour taper *ce texte* entouré d'astérisques mais pas en italique :
+Tapez \*ce texte\*.
+
+<!-- Tableaux -->
+<!-- les Tableaux ne sont disponibles que dans le Github Flavored Markdown
+ et c'est ce n'est pas super agréable d'utilisation.
+ Mais si vous en avez besoin :
+ -->
+
+| Col1 | Col2 | Col3 |
+| :----------- | :------: | ------------: |
+| Alignement Gauche | Centé | Alignement Droite |
+| bla | bla | bla |
+
+<!-- ou bien, pour un résultat équivalent : -->
+
+Col 1 | Col2 | Col3
+:-- | :-: | --:
+Ough que c'est moche | svp | arrêtez
+
+<!-- Fin! -->
+
+```
+
+Pour plus d'information :
+ consultez [ici](http://daringfireball.net/projects/markdown/syntax) le post officiel de Jhon Gruber à propos de la syntaxe,
+ et [là](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) la superbe cheatsheet de Adam Pritchard. \ No newline at end of file
diff --git a/fr-fr/xml-fr.html.markdown b/fr-fr/xml-fr.html.markdown
index d7e76892..ed5f55ff 100644
--- a/fr-fr/xml-fr.html.markdown
+++ b/fr-fr/xml-fr.html.markdown
@@ -4,7 +4,8 @@ contributors:
- ["João Farias", "https://github.com/JoaoGFarias"]
translators:
- ["Geoffrey Liu", "https://github.com/g-liu"]
-filename: learnxml.xml
+filename: learnxml-fr.xml
+lang: fr-fr
---
XML est un langage de balisage conçu pour stocker et transporter les informations.
diff --git a/haml.html.markdown b/haml.html.markdown
new file mode 100644
index 00000000..aed3dcae
--- /dev/null
+++ b/haml.html.markdown
@@ -0,0 +1,155 @@
+---
+language: haml
+filename: learnhaml.haml
+contributors:
+ - ["Simon Neveu", "https://github.com/sneveu"]
+---
+
+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.
+
+It aims to reduce repetition in your markup by closing tags for you based on the structure of the indents in your code. The result is markup that is well-structured, DRY, logical, and easier to read.
+
+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.
+
+$ haml input_file.haml output_file.html
+
+
+```haml
+/ -------------------------------------------
+/ Indenting
+/ -------------------------------------------
+
+/
+ Because of the importance indentation has on how your code is rendered, the
+ indents should be consistent throughout the document. Any differences in
+ indentation will throw an error. It's common-practice to use two spaces,
+ but it's really up to you, as long as they're constant.
+
+
+/ -------------------------------------------
+/ Comments
+/ -------------------------------------------
+
+/ This is what a comment looks like in Haml.
+
+/
+ To write a multi line comment, indent your commented code to be
+ wrapped by the forward slash
+
+-# This is a silent comment, which means it wont be rendered into the doc at all
+
+
+/ -------------------------------------------
+/ Html elements
+/ -------------------------------------------
+
+/ To write your tags, use the percent sign followed by the name of the tag
+%body
+ %header
+ %nav
+
+/ Notice no closing tags. The above code would output
+ <body>
+ <header>
+ <nav></nav>
+ </header>
+ </body>
+
+/ The div tag is the default element, so they can be written simply like this
+.foo
+
+/ To add content to a tag, add the text directly after the declaration
+%h1 Headline copy
+
+/ To write multiline content, nest it instead
+%p
+ This is a lot of content that we could probably split onto two
+ separate lines.
+
+/
+ You can escape html by using the ampersand and equals sign ( &= ). This
+ converts html-sensitive characters (&, /, :) into their html encoded
+ equivalents. For example
+
+%p
+ &= "Yes & yes"
+
+/ would output 'Yes &amp; yes'
+
+/ You can unescape html by using the bang and equals sign ( != )
+%p
+ != "This is how you write a paragraph tag <p></p>"
+
+/ which would output 'This is how you write a paragraph tag <p></p>'
+
+/ CSS classes can be added to your tags either by chaining .classnames to the tag
+%div.foo.bar
+
+/ or as part of a Ruby hash
+%div{:class => 'foo bar'}
+
+/ Attributes for any tag can be added in the hash
+%a{:href => '#', :class => 'bar', :title => 'Bar'}
+
+/ For boolean attributes assign the value 'true'
+%input{:selected => true}
+
+/ To write data-attributes, use the :data key with its value as another hash
+%div{:data => {:attribute => 'foo'}}
+
+
+/ -------------------------------------------
+/ Inserting Ruby
+/ -------------------------------------------
+
+/
+ To output a Ruby value as the contents of a tag, use an equals sign followed
+ by the Ruby code
+
+%h1= book.name
+
+%p
+ = book.author
+ = book.publisher
+
+
+/ To run some Ruby code without rendering it to the html, use a hyphen instead
+- books = ['book 1', 'book 2', 'book 3']
+
+/ Allowing you to do all sorts of awesome, like Ruby blocks
+- books.shuffle.each_with_index do |book, index|
+ %h1= book
+
+ if book do
+ %p This is a book
+
+/
+ Again, no need to add the closing tags to the block, even for the Ruby.
+ Indentation will take care of that for you.
+
+
+/ -------------------------------------------
+/ Inline Ruby / Ruby interpolation
+/ -------------------------------------------
+
+/ Include a Ruby variable in a line of plain text using #{}
+%p Your highest scoring game is #{best_game}
+
+
+/ -------------------------------------------
+/ Filters
+/ -------------------------------------------
+
+/
+ 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
+
+:javascript
+ console.log('This is inline <script>');
+
+```
+
+## Additional resources
+
+- [What is HAML?](http://haml.info/) - A good introduction that does a much better job of explaining the benefits of using HAML.
+- [Official Docs](http://haml.info/docs/yardoc/file.REFERENCE.html) - If you'd like to go a little deeper.
diff --git a/haskell.html.markdown b/haskell.html.markdown
index ad12de2a..2785405c 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -171,8 +171,8 @@ foldl1 (\acc x -> acc + x) [1..5] -- 15
-- 4. More functions
----------------------------------------------------
--- currying: if you don't pass in all the arguments to a function,
--- it gets "curried". That means it returns a function that takes the
+-- partial application: if you don't pass in all the arguments to a function,
+-- it gets "partially applied". That means it returns a function that takes the
-- rest of the arguments.
add a b = a + b
diff --git a/javascript.html.markdown b/javascript.html.markdown
index 7c869b28..792cab98 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -39,13 +39,14 @@ doStuff()
// 1. Numbers, Strings and Operators
// JavaScript has one number type (which is a 64-bit IEEE 754 double).
-// As with Lua, don't freak out about the lack of ints: doubles have a 52-bit
-// mantissa, which is enough to store integers up to about 9✕10¹⁵ precisely.
+// Doubles have a 52-bit mantissa, which is enough to store integers
+// up to about 9✕10¹⁵ precisely.
3; // = 3
1.5; // = 1.5
-// All the basic arithmetic works as you'd expect.
+// Some basic arithmetic works as you'd expect.
1 + 1; // = 2
+.1 + .2; // = 0.30000000000000004
8 - 1; // = 7
10 * 2; // = 20
35 / 5; // = 7
@@ -77,13 +78,13 @@ false;
!true; // = false
!false; // = true
-// Equality is ==
-1 == 1; // = true
-2 == 1; // = false
+// Equality is ===
+1 === 1; // = true
+2 === 1; // = false
-// Inequality is !=
-1 != 1; // = false
-2 != 1; // = true
+// Inequality is !==
+1 !== 1; // = false
+2 !== 1; // = true
// More comparisons
1 < 10; // = true
@@ -97,11 +98,13 @@ false;
// and are compared with < and >
"a" < "b"; // = true
-// Type coercion is performed for comparisons...
+// Type coercion is performed for comparisons with double equals...
"5" == 5; // = true
+null == undefined; // = true
// ...unless you use ===
"5" === 5; // = false
+null === undefined; // = false
// You can access characters in a string with charAt
"This is a string".charAt(0); // = 'T'
diff --git a/matlab.html.markdown b/matlab.html.markdown
index 9dae8ef2..121f16de 100644
--- a/matlab.html.markdown
+++ b/matlab.html.markdown
@@ -40,36 +40,41 @@ ctrl-c % Abort current computation
edit('myfunction.m') % Open function/script in editor
type('myfunction.m') % Print the source of function/script to Command Window
-profile viewer % Open profiler
+profile on % turns on the code profiler
+profile of % turns off the code profiler
+profile viewer % Open profiler
-help command % Displays documentation for command in Command Window
-doc command % Displays documentation for command in Help Window
-lookfor command % Searches for a given command
+help command % Displays documentation for command in Command Window
+doc command % Displays documentation for command in Help Window
+lookfor command % Searches for command in the first commented line of all functions
+lookfor command -all % searches for command in all functions
% Output formatting
-format short % 4 decimals in a floating number
-format long % 15 decimals
-format bank % only two digits after decimal point - for financial calculations
-fprintf
+format short % 4 decimals in a floating number
+format long % 15 decimals
+format bank % only two digits after decimal point - for financial calculations
+fprintf('text') % print "text" to the screen
+disp('text') % print "text" to the screen
% Variables & Expressions
-myVariable = 4 % Notice Workspace pane shows newly created variable
+myVariable = 4 % Notice Workspace pane shows newly created variable
myVariable = 4; % Semi colon suppresses output to the Command Window
-4 + 6 % ans = 10
-8 * myVariable % ans = 32
-2 ^ 3 % ans = 8
+4 + 6 % ans = 10
+8 * myVariable % ans = 32
+2 ^ 3 % ans = 8
a = 2; b = 3;
c = exp(a)*sin(pi/2) % c = 7.3891
% Calling functions can be done in either of two ways:
% Standard function syntax:
-load('myFile.mat', 'y')
+load('myFile.mat', 'y') % arguments within parantheses, spererated by commas
% Command syntax:
-load myFile.mat y % no parentheses, and spaces instead of commas
+load myFile.mat y % no parentheses, and spaces instead of commas
% Note the lack of quote marks in command form: inputs are always passed as
% literal text - cannot pass variable values. Also, can't receive output:
-[V,D] = eig(A) % this has no equivalent in command form
+[V,D] = eig(A); % this has no equivalent in command form
+[~,D] = eig(A); % if you only want D and not V
@@ -100,6 +105,10 @@ a = {'one', 'two', 'three'}
a(1) % ans = 'one' - returns a cell
char(a(1)) % ans = one - returns a string
+% Structures
+A.b = {'one','two'};
+A.c = [1 2];
+A.d.e = false;
% Vectors
x = [4 32 53 7 1]
@@ -160,6 +169,10 @@ A(1,:) % All columns in row 1
% 4 5 42
% 7 8 9
+% this is the same as
+vertcat(A,A);
+
+
[A , A] % Concatenation of matrices (horizontally)
%ans =
@@ -168,6 +181,8 @@ A(1,:) % All columns in row 1
% 4 5 42 4 5 42
% 7 8 9 7 8 9
+% this is the same as
+horzcat(A,A);
A(:, [3 1 2]) % Rearrange the columns of original matrix
@@ -180,10 +195,13 @@ A(:, [3 1 2]) % Rearrange the columns of original matrix
size(A) % ans = 3 3
A(1, :) =[] % Delete the first row of the matrix
+A(:, 1) =[] % Delete the first column of the matrix
+transpose(A) % Transpose the matrix, which is the same as:
+A'
ctranspose(A) % Hermitian transpose the matrix
% (the transpose, followed by taking complex conjugate of each element)
-transpose(A) % Transpose the matrix, without taking complex conjugate
+
diff --git a/nl-nl/brainfuck-nl.html.markdown b/nl-nl/brainfuck-nl.html.markdown
new file mode 100644
index 00000000..cd12b1d0
--- /dev/null
+++ b/nl-nl/brainfuck-nl.html.markdown
@@ -0,0 +1,86 @@
+---
+language: brainfuck
+contributors:
+ - ["Prajit Ramachandran", "http://prajitr.github.io/"]
+ - ["Mathias Bynens", "http://mathiasbynens.be/"]
+translators:
+ - ["Jelle Besseling", "https://github.com/Jell-E"]
+lang: nl-nl
+---
+
+Brainfuck (schrijf je niet met een hoofdletter behalve aan het begin van een
+zin) is een extreem
+minimalistische Turing-complete programmeertaal met maar acht commando's.
+
+```
+Elk karakter behalve "><+-.,[]" (en de quotes) wordt genegeerd.
+
+Brainfuck wordt gerepresenteerd door een array met 30,000 cellen die initieel
+gevuld is met nullen en een pointer die wijst naar de huidige cel.
+
+Dit zijn de acht commando's:
++ : Verhoog de huidige cell met 1.
+- : Verminder de huidige cell met 1.
+> : Beweeg de pointer naar de volgende cell (één naar rechts).
+< : Beweeg de pointer naar de vorige cell (één naar links).
+. : Print de huidige cell als een ASCII karakter(d.w.z. 65 = 'A').
+, : Lees een karakter in de huidige cell.
+[ : Als de huidige cell nul is ga dan naar de bijbehorende ] .
+ Als het geen nul is, ga dan gewoon verder.
+] : Als de huidige cell nul is ga dan gewoon verder.
+ Als het geen nul is, ga dan terug naar de bijbehorende [ .
+
+[ en ] maken een while loop. Ze moeten uiteraard wel gebalanceerd zijn
+
+Laten we een kijkje nemen naar een paar brainfuck programma's.
+
+++++++ [ > ++++++++++ < - ] > +++++ .
+
+Dit programma print het karakter 'A'. Eerst verhoogt het cell #1 tot 6.
+Cell #1 wordt gebruikt om te loopen. Dan begint het de loop ([) en gaat
+naar cell #2. Het verhoogt cell #2 tien keer, gaat terug naar cell #1, en
+verlaagt cell #1. Deze loop gebeurt zes keer (na zes keer staat cell #1
+weer op nul, waarna het doorgaat naar het einde van de loop (]) en
+verder gaat).
+
+De pointer staat nu weer op cell #1, deze heeft een waarde van 0, en cell #2
+heeft een waarde van 60. > beweegt de pointer naar cell #2, daarna verhoogt
+het de cell vijf keer, waardoor het een waarde van 65 bevat, en print dan
+de waarde van cell #2. 65 is 'A' in ASCII, dus 'A' wordt geprint in de terminal.
+
+
+, [ > + < - ] > .
+
+Dit programma leest een karakter van de gebruiker in put en kopieert dat
+karakter in cel #1. Dan start de loop. Ga naar cel #2, verhoog de waarde in
+cel #2, ga terug naar cel #1, en verklein de waarde in cel #1. Dit gaat door
+totdat cel #1 nul is en cel #2 de oude waarde heeft van cell #1. Omdat we
+op cel #1 staan verplaatst > de pointer één naar rechts en . print het
+karakter in cel #2.
+
+Houd wel in gedachten dat de spaties alleen zijn voor leesbaarheid, je kan het
+bovenstaande programma net zo goed schrijven als:
+
+,[>+<-]>.
+
+Probeer maar eens te bedenken wat het volgende programma doet:
+
+,>,< [ > [ >+ >+ << -] >> [- << + >>] <<< -] >>
+
+Dit programma neemt twee getallen als input, en vermenigvuldigt ze.
+
+In het begin leest het twee karakters in cel #1 en #2. Dan start het de
+buitenste loop, met als teller cel #1. Het beweegt naar cel #2, dan start het
+de binnenste loop met als teller cel #2, daar verhoogd het cel #3. Maar
+dan is er een probleem als cel #2 nul wordt aan het einde van de binnenste loop.
+Om dit op te lossen wordt ook cel #4 verhoogd naar het oorspronkelijke getal
+uit cel #2 en daarna wordt cel #4 weer gekopieerd naar cell #2.
+Het resultaat komt in cel #3 te staan.
+```
+
+En dat is dan brainfuck. Niet heel moeilijk, toch? Je kan zelf voor de lol
+brainfuck programma's gaan schrijven, of je kan een interpreter schrijven
+voor brainfuck in een andere taal. Het is namelijk redelijk makkelijk om te
+implementeren aangezien brainfuck maar acht commando's heeft. En als je een
+masochist bent kan je ook nog proberen om brainfuck te implementeren… in
+brainfuck.
diff --git a/nl-nl/coffeescript-nl.html.markdown b/nl-nl/coffeescript-nl.html.markdown
index 70dcd463..dc0b1e19 100644
--- a/nl-nl/coffeescript-nl.html.markdown
+++ b/nl-nl/coffeescript-nl.html.markdown
@@ -5,23 +5,24 @@ contributors:
- ["Xavier Yao", "http://github.com/xavieryao"]
translators:
- ["Jelle Besseling", "https://github.com/Jell-E"]
+ - ["D.A.W. de Waal", "http://github.com/diodewaal"]
filename: coffeescript-nl.coffee
lang: nl-nl
---
-CoffeeScript is een kleine programmeertaal die compileerd naar JavaScript,
-er is geen interpretatie tijdens het uitvoeren.
-Als een van de nakomelingen van JavaScript probeert CoffeeScript om leesbare,
-goed geformatteerdeen goed draaiende JavaScript code te genereren,
-die in elke JavaScript runtime werkt.
+CoffeeScript is een kleine programmeertaal die direct compileert naar
+JavaScript en er is geen interpretatie tijdens het uitvoeren.
+CoffeeScript probeert om leesbare, goed geformatteerde en goed draaiende
+JavaScript code te genereren, die in elke JavaScript runtime werkt, als een
+opvolger van JavaScript.
-Op [de CoffeeScript website](http://coffeescript.org/), staat een
-vollediger tutorial voor CoffeeScript.
+Op [de CoffeeScript website](http://coffeescript.org/), staat een
+volledigere tutorial voor CoffeeScript.
``` coffeescript
# CoffeeScript is een taal voor hipsters.
# Het gaat mee met alle trends van moderne talen.
-# Dus commentaar begint met een hekje, net zoals bij Python en Ruby.
+# Commentaar begint dus met een hekje, net zoals bij Python en Ruby.
###
Blokken commentaar maak je zo, ze vertalen naar JavaScripts */ en /*
@@ -47,7 +48,7 @@ vul = (houder, vloeistof = "koffie") ->
#
#vul = function(houder, vloeistof) {
# if (vloeistof == null) {
-# vloeistof = "coffee";
+# vloeistof = "koffie";
# }
# return "Nu de " + houder + " met " + vloeistof + " aan het vullen...";
#};
@@ -75,12 +76,12 @@ wedstrijd = (winnaar, lopers...) ->
# return print(winnaar, lopers);
#};
-# Bestaan:
+# Aanwezigheid:
alert "Ik wist het!" if elvis?
#=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); }
# Lijst abstractie:
-derdemachten = (wiskunde.derdemacht num for num in lijst)
+derdemachten = (wiskunde.derdemacht num for num in lijst)
#=>derdemachten = (function() {
# var _i, _len, _results;
# _results = [];
diff --git a/ocaml.html.markdown b/ocaml.html.markdown
index b9505f13..f9db7080 100644
--- a/ocaml.html.markdown
+++ b/ocaml.html.markdown
@@ -93,7 +93,7 @@ let inc_int (x: int) : int = x + 1 ;;
(* You need to mark recursive function definitions as such with "rec" keyword. *)
let rec factorial n =
if n = 0 then 1
- else factorial n * factorial (n-1)
+ else n * factorial (n-1)
;;
(* Function application usually doesn't need parentheses around arguments *)
diff --git a/ru-ru/markdown-ru.html.markdown b/ru-ru/markdown-ru.html.markdown
new file mode 100644
index 00000000..eb8e4881
--- /dev/null
+++ b/ru-ru/markdown-ru.html.markdown
@@ -0,0 +1,279 @@
+---
+language: markdown
+contributors:
+ - ["Dan Turkel", "http://danturkel.com/"]
+ - ["Pirogov Alexey", "http://twitter.com/alex_pir"]
+filename: markdown-ru.md
+lang: ru-ru
+---
+
+Язык разметки Markdown создан Джоном Грубером (англ. John Gruber)
+и Аароном Шварцем (англ. Aaron H. Swartz) в 2004 году.
+Авторы задавались целью создать максимально удобочитаемый
+и удобный в публикации облегчённый язык разметки,
+пригодный для последующего преобразования в HTML
+(а также и в другие форматы).
+
+ ```markdown
+<!-- Markdown является надмножеством HTML, поэтому любой HTML-файл является
+валидным документом Markdown, что позволяет использовать напрямую
+любые элементы HTML-разметки, такие, например, как этот комментарий.
+ Встроенные в документ HTML-элементы не затрагиваются парсером Markdown
+и попадают в итоговый HTML без изменений. Однако, следует понимать,
+что эта же особенность не позволяет использовать разметку Markdown внутри
+HTML-элементов -->
+
+<!-- Ещё одна особенность формата Markdown состоит в том, что поддерживаемые
+возможности разметки зависят от конкретной реализации парсера. В данном
+руководстве возможности, поддерживаемые лишь определёнными парсерами,
+сопровождаются соответствующими примечаниями. -->
+
+<!-- Заголовки -->
+
+<!-- HTML-элементы от <h1> до <h6> размечаются очень просто:
+текст, который должен стать заголовком, предваряется
+соответствующим количеством символов "#": -->
+# Это заголовок h1
+## Это заголовок h2
+### Это заголовок h3
+#### Это заголовок h4
+##### Это заголовок h5
+###### Это заголовок h6
+
+<!-- Markdown позволяет размечать заголовки <h1> и <h2> ещё одним способом: -->
+Это заголовок h1
+================
+
+А это заголовок h2
+------------------
+
+<!-- Простейшая стилизация текста -->
+
+<!-- Текст легко сделать полужирным и/или курсивным: -->
+
+*Этот текст будет выведен курсивом.*
+_Так же, как этот._
+
+**А этот текст будет полужирным.**
+__И этот тоже.__
+
+***Полужирный курсив.***
+**_И тут!_**
+*__И даже здесь!__*
+
+<!-- В Github Flavored Markdown (версии Markdown, использующейся в Github,
+для рендеринга Markdown-документов) текст можно сделать зачёркнутым: -->
+
+~~Зачёркнутый текст.~~
+
+<!-- Абзацами являются любые строки, следующие друг за другом.
+Разделяются же абзацы одной или несколькими пустыми строками: -->
+
+Это абзац. Всё предельно просто.
+
+А тут уже параграф №2.
+Эта строка всё ещё относится к параграфу №2!
+
+
+О, а вот это уже параграф №3!
+
+<!-- Для вставки принудительных переносов можно использовать HTML-тэг <br/>: -->
+
+Принудительный <br/> перенос!
+
+<!-- Цитаты размечаются с помощью символа ">": -->
+
+> Это цитата. В цитатах можно
+> принудительно переносить строки, вставляя ">" в начало каждой следующей строки. А можно просто оставлять достаточно длинными, и такие длинные строки будут перенесены автоматически.
+> Разницы между этими двумя подходами к переносу строк нет, коль скоро
+> каждая строка начинается с символа ">"
+
+> А ещё цитаты могут быть многоуровневыми:
+>> как здесь
+>>> и здесь :)
+> Неплохо?
+
+<!-- Списки -->
+<!-- Маркированные списки размечаются вставкой в начало каждого элемента
+одного из символов "*", "+" или "-":
+(символ должен быть одним и тем же для всех элементов) -->
+
+* Список,
+* Размеченный
+* Звёздочками
+
+либо
+
++ Список,
++ Размеченный
++ Плюсами
+
+либо
+
+- Список,
+- Размеченный
+- Дефисами
+
+<!-- В нумерованных списках каждая строка начинается
+с числа и точки вслед за ним: -->
+
+1. Первый элемент
+2. Второй элемент
+3. Третий элемент
+
+<!-- Заметьте, нумеровать элементы корректно необязательно. Достаточно указать
+любое число в начале каждого элемента и рендер пронумерует элементы сам!
+Правда, злоупотреблять этим не стоит :) -->
+
+1. Первый элемент
+1. Второй элемент
+1. Третий элемент
+<!-- (Этот список будет отрендерен так же, как и предыдущий!) -->
+
+<!-- Списки могут быть вложенными: -->
+
+1. Введение
+2. Начало работы
+3. Примеры использования
+ * Простые
+ * Сложные
+4. Заключение
+
+<!-- Блоки с исходным кодом -->
+<!-- Фрагменты исходного кода выделяются очень просто - каждая строка блока должна иметь отступ в четыре пробела либо в один символ табуляции -->
+
+ Это код,
+ причём - многострочный
+
+<!-- Дополнительные отступы в коде следует делать с помощью четырёх пробелов: -->
+
+ my_array.each do |item|
+ puts item
+ end
+
+<!-- Иногда бывает нужно вставить фрагмент кода прямо в строку текста,
+не выделяя код в блок. Для этого фрагменты кода нужно обрамлять
+символами "`": -->
+
+Например, можно выделить имя функции `go_to()` прямо посреди текста.
+
+<!-- Github Flavored Markdown позволяет указать для блока кода синтаксис оного.
+В этом случае синтаксис внутри блока будет подсвечен. Пример: -->
+
+\`\`\`ruby <!-- Только нужно будет убрать символы "\", оставив лишь "```ruby" -->
+def foobar
+ puts "Hello world!"
+end
+\`\`\` <!-- И здесь тоже backslashes нужно убрать, т.е. оставить "```" -->
+
+<-- Обратите внимание: фрагмент, указанный выше, не предваряется отступами,
+поскольку Github сам в состоянии определить границы блока - по строкам "```" -->
+
+<!-- Горизонтальный разделитель (<hr />) -->
+<!-- Разделители добавляются вставкой строки из трёх и более
+(одинаковых) символов "*" или "-": -->
+
+***
+---
+- - - <!-- между символами допустимы пробелы -->
+****************
+
+<!-- Ссылки -->
+<!-- Одной из сильных сторон Markdown можно смело считать то,
+как просто размечаются гиперссылки. Для создания ссылки укажите
+текст ссылки, заключив его в квадратные скобки,
+и сразу после - url, заключенный в "круглые" -->
+
+[Ссылка!](http://test.com/)
+
+<!-- Также для ссылки можно указать всплывающую подсказку: -->
+
+[Ссылка!](http://test.com/ "Ссылка на Test.com")
+
+<!-- В url можно использовать относительные пути: -->
+
+[Перейти к музыке](/music/).
+
+<!-- Markdown позволяет размечать ссылку в виде сноски: -->
+
+[Здесь][link1] высможете узнать больше!
+А можно кликнуть [сюда][foobar], если очень хочется.
+
+<!-- где-нибудь внизу -->
+[link1]: http://test.com/ "Круто!"
+[foobar]: http://foobar.biz/ "Тоже хорошо!"
+
+<!-- Примечания:
+- Подсказка может быть заключена в одинарные кавычки вместо двойных,
+ а также в круглые скобки.
+- Сноска может находиться в любом месте документа и может иметь
+идентификатор (далее ID) произвольной длины,
+лишь бы это ID был уникальным. -->
+
+<!-- Также при разметке ссылок-сносок можно опустить ID,
+если текст ссылки уникален в пределах документа: -->
+
+Ссылка на [Google][].
+
+[google]: http://google.com/
+
+<!-- Правда, эта возможность не очень распространена. -->
+
+<!-- Изображения -->
+<!-- Разметка изображений очень похожа на разметку ссылок.
+Нужно всего лишь добавить "!" перед ссылкой! -->
+
+![Альтернативный текст для изображения](http://imgur.com/myimage.jpg "Подсказка")
+
+<!-- Изображения тоже могут быть оформлены, как сноски: -->
+
+![Альтернативный текст][myimage]
+
+![То же изображение ещё раз][myimage]
+
+[myimage]: relative/urls/cool/image.jpg "подсказка"
+
+<!-- Ещё немного ссылок: -->
+<!-- Автоссылки -->
+
+Ссылка вида <http://testwebsite.com/> эквивалентна
+[http://testwebsite.com/](http://testwebsite.com/)
+
+<!-- Автоссылки для адресов электронной почты -->
+
+<foo@bar.com>
+
+<!-- Экранирование символов -->
+
+<!-- Может потребоваться вставить спецсимвол в текст "как есть",
+т.е. защитить его от обработки парсером.
+Такой символ должен быть "экранирован" с помощью обратной косой черты
+(символа "\"): -->
+
+\*текст, заключённый в звёздочки!\*
+
+<!-- Таблицы -->
+<!-- Таблицы официально поддерживаются только в Github Flavored Markdown,
+да и синтаксис имеют не слишком удобный.
+Но если очень нужно, размечайте таблицы так: -->
+
+| Столбец 1 | Столбец 2 | Столбец 3 |
+| :----------- | :----------: | -----------: |
+| Выравнивание | Выравнивание | Выравнивание |
+| влево | по центру | вправо |
+
+<!-- Или более компактно -->
+
+Колонка 1|Колонка 2|Колонка 3
+:--|:-:|--:
+Выглядит|это|страшновато...
+
+<!-- Ну вот и всё! -->
+
+```
+
+За более подробной информацией обращайтесь к [статье](http://daringfireball.net/projects/markdown/syntax) Джона Грубера о синтаксисе Markdown.
+
+Также часто бывает полезной отличная ["шпаргалка"](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) по Markdown от Adam Pritchard.
+
+Если вдруг встретите ошибки в переводе или же захотите его дополнить, делайте pull requests - авторы всегда рады обратной связи!
diff --git a/swift.html.markdown b/swift.html.markdown
index 77047355..005e511c 100644
--- a/swift.html.markdown
+++ b/swift.html.markdown
@@ -13,6 +13,9 @@ The official [Swift Programming Language](https://itunes.apple.com/us/book/swift
See also Apple's [getting started guide](https://developer.apple.com/library/prerelease/ios/referencelibrary/GettingStarted/LandingPage/index.html), which has a complete tutorial on Swift.
```swift
+// import a module
+import UIKit
+
//
// MARK: Basics
//
@@ -24,9 +27,12 @@ See also Apple's [getting started guide](https://developer.apple.com/library/pre
println("Hello, world")
+// variables (var) value can change after being set
+// constants (let) value can NOT be changed after being set
+
var myVariable = 42
let øπΩ = "value" // unicode variable names
-let myConstant = 3.1415926
+let π = 3.1415926
let convenience = "keyword" // contextual variable name
let weak = "keyword"; let override = "another keyword" // statements can be separated by a semi-colon
let `class` = "keyword" // backticks allow keywords to be used as variable names
@@ -34,9 +40,58 @@ let explicitDouble: Double = 70
let intValue = 0007 // 7
let largeIntValue = 77_000 // 77000
let label = "some text " + String(myVariable) // Casting
-let piText = "Pi = \(myConstant), Pi 2 = \(myConstant * 2)" // String interpolation
-var optionalString: String? = "optional" // Can be nil
-optionalString = nil
+let piText = "Pi = \(π), Pi 2 = \(π * 2)" // String interpolation
+
+// Build Specific values
+// uses -D build configuration
+#if false
+ println("Not printed")
+ let buildValue = 3
+#else
+ let buildValue = 7
+#endif
+println("Build value: \(buildValue)") // Build value: 7
+
+/*
+ Optionals are a Swift language feature that allows you to store a `Some` or
+ `None` value.
+
+ Because Swift requires every property to have a value, even nil must be
+ explicitly stored as an Optional value.
+
+ Optional<T> is an enum.
+*/
+var someOptionalString: String? = "optional" // Can be nil
+// same as above, but ? is a postfix operator (syntax candy)
+var someOptionalString2: Optional<String> = "optional"
+
+if someOptionalString != nil {
+ // I am not nil
+ if someOptionalString!.hasPrefix("opt") {
+ println("has the prefix")
+ }
+
+ let empty = someOptionalString?.isEmpty
+}
+someOptionalString = nil
+
+// implicitly unwrapped optional
+var unwrappedString: String! = "Value is expected."
+// same as above, but ! is a postfix operator (more syntax candy)
+var unwrappedString2: ImplicitlyUnwrappedOptional<String> = "Value is expected."
+
+if let someOptionalStringConstant = someOptionalString {
+ // has `Some` value, non-nil
+ if !someOptionalStringConstant.hasPrefix("ok") {
+ // does not have the prefix
+ }
+}
+
+// Swift has support for storing a value of any type.
+// AnyObject == id
+// Unlike Objective-C `id`, AnyObject works with any value (Class, Int, struct, etc)
+var anyObjectVar: AnyObject = 7
+anyObjectVar = "Changed value to a string, not good practice, but possible."
/*
Comment here
@@ -49,10 +104,17 @@ Comment here
// MARK: Collections
//
+/*
+ Array and Dictionary types are structs. So `let` and `var` also indicate
+ that they are mutable (var) or immutable (let) when declaring these types.
+*/
+
// Array
var shoppingList = ["catfish", "water", "lemons"]
shoppingList[1] = "bottle of water"
-let emptyArray = [String]()
+let emptyArray = [String]() // immutable
+var emptyMutableArray = [String]() // mutable
+
// Dictionary
var occupations = [
@@ -60,7 +122,8 @@ var occupations = [
"kaylee": "Mechanic"
]
occupations["Jayne"] = "Public Relations"
-let emptyDictionary = [String: Float]()
+let emptyDictionary = [String: Float]() // immutable
+var emptyMutableDictionary = [String: Float]() // mutable
//
@@ -84,9 +147,10 @@ for (key, value) in dict {
}
// for loop (range)
-for i in -1...1 { // [-1, 0, 1]
+for i in -1...shoppingList.count {
println(i)
}
+shoppingList[1...2] = ["steak", "peacons"]
// use ..< to exclude the last number
// while loop
@@ -123,14 +187,14 @@ default: // required (in order to cover all possible input)
// Function with Swift header docs (format as reStructedText)
/**
- A greet operation
+A greet operation
- - A bullet in docs
- - Another bullet in the docs
+- A bullet in docs
+- Another bullet in the docs
- :param: name A name
- :param: day A day
- :returns: A string containing the name and day value.
+:param: name A name
+:param: day A day
+:returns: A string containing the name and day value.
*/
func greet(name: String, day: String) -> String {
return "Hello \(name), today is \(day)."
@@ -141,9 +205,19 @@ greet("Bob", "Tuesday")
func getGasPrices() -> (Double, Double, Double) {
return (3.59, 3.69, 3.79)
}
+let pricesTuple = getGasPrices()
+let price = pricesTuple.2 // 3.79
+// Ignore Tuple (or other) values by using _ (underscore)
+let (_, price1, _) = pricesTuple // price1 == 3.69
+println(price1 == pricesTuple.1) // true
+println("Gas price: \(price)")
// Variadic Args
-func setup(numbers: Int...) {}
+func setup(numbers: Int...) {
+ // its an array
+ let number = numbers[0]
+ let argCount = numbers.count
+}
// Passing and returning functions
func makeIncrementer() -> (Int -> Int) {
@@ -155,6 +229,17 @@ func makeIncrementer() -> (Int -> Int) {
var increment = makeIncrementer()
increment(7)
+// pass by ref
+func swapTwoInts(inout a: Int, inout b: Int) {
+ let tempA = a
+ a = b
+ b = tempA
+}
+var someIntA = 7
+var someIntB = 3
+swapTwoInts(&someIntA, &someIntB)
+println(someIntB) // 7
+
//
// MARK: Closures
@@ -197,7 +282,7 @@ print(numbers) // [3, 6, 18]
// Structures and classes have very similar capabilites
struct NamesTable {
let names: [String]
-
+
// Custom subscript
subscript(index: Int) -> String {
return names[index]
@@ -239,7 +324,7 @@ internal class Rect: Shape {
sideLength = newValue / 4
}
}
-
+
// Lazily load a property
// subShape remains nil (uninitialized) until getter called
lazy var subShape = Rect(sideLength: 4)
@@ -255,8 +340,9 @@ internal class Rect: Shape {
}
init(sideLength: Int) {
- super.init()
self.sideLength = sideLength
+ // always super.init last when init custom properties
+ super.init()
}
func shrink() {
@@ -313,7 +399,7 @@ enum Suit {
//
// `protocol`s can require that conforming types have specific
-// instance properties, instance methods, type methods,
+// instance properties, instance methods, type methods,
// operators, and subscripts.
protocol ShapeGenerator {
@@ -321,7 +407,6 @@ protocol ShapeGenerator {
func buildShape() -> Shape
}
-/*
// Protocols declared with @objc allow optional functions,
// which allow you to check for conformance
@objc protocol TransformShape {
@@ -331,17 +416,17 @@ protocol ShapeGenerator {
class MyShape: Rect {
var delegate: TransformShape?
-
+
func grow() {
sideLength += 2
-
+
if let allow = self.delegate?.canReshape?() {
// test for delegate then for method
self.delegate?.reshaped?()
}
}
}
-*/
+
//
// MARK: Other
@@ -363,7 +448,7 @@ extension Int {
var customProperty: String {
return "This is \(self)"
}
-
+
func multiplyBy(num: Int) -> Int {
return num * self
}
@@ -372,7 +457,7 @@ extension Int {
println(7.customProperty) // "This is 7"
println(14.multiplyBy(2)) // 42
-// Generics: Similar to Java. Use the `where` keyword to specify the
+// Generics: Similar to Java and C#. Use the `where` keyword to specify the
// requirements of the generics.
func findIndex<T: Equatable>(array: [T], valueToFind: T) -> Int? {
diff --git a/vi-vn/git-vi.html.markdown b/vi-vn/git-vi.html.markdown
index bdb88204..1bcc94a0 100644
--- a/vi-vn/git-vi.html.markdown
+++ b/vi-vn/git-vi.html.markdown
@@ -2,14 +2,15 @@
category: tool
tool: git
contributors:
- - ["Jake Prather", "http://github.com/JakeHP"]
+ - ["Jake Prather", "http://github.com/JakeHP"]
+ - ["Vinh Nguyen", "https://twitter.com/vinhnx"]
filename: LearnGit-vi.txt
lang: vi-vn
---
Git là một hệ quản lý mã nguồn và phiên bản phân tán (distributed version control and source code management system).
-Nó làm được điều này là do một loạt các snapshot từ đề án của bạn, and nó hoạt động
+Nó làm được điều này là do một loạt các snapshot từ đề án của bạn, và nó hoạt động
với các snapshot đó để cung cấp cho bạn với chức năng đến phiên bản và
quản lý mã nguồn của bạn.
@@ -19,7 +20,7 @@ quản lý mã nguồn của bạn.
Version Control là một hệ thống ghi lại những thay đổi ở một tập tin, hay một nhóm các tập tin, theo thời gian.
-### Centralized Versioning VS Distributed Versioning
+### So sánh giữa Centralized Versioning và Distributed Versioning
* Quản lý phiên bản tập trung (Centralized Versioning) tập trung vào việc đồng bộ hóa, theo dõi, và lưu trữ tập tin.
* Quản lý phiên bản phân tán (Distributed Versioning) tập trung vào việc chia sẻ các thay đổi. Mỗi sự thay đổi có một mã định dạng (id) duy nhất.
@@ -75,7 +76,7 @@ con trỏ này sẽ cập nhật tự động và trỏ đến commit mới nh
### HEAD và head (thành phần của thư mục .git)
-HEAD là một con trỏ đến nhánh hiện tại. Một repo chỉ có một HEAD *đang hoạt động*.
+HEAD là một con trỏ đến branch hiện tại. Một repo chỉ có một HEAD *đang hoạt động*.
head là một con trỏ đến bất kỳ commit nào. Một repo có thể có nhiều head.
### Các Tài Nguyên Mang Tính Khái Niệm
@@ -165,29 +166,29 @@ $ git add ./*.java
### branch
-Quản lý nhánh. Bạn có thể xem, sửa, tạo, xóa các nhánh bằng cách dùng lệnh này.
+Quản lý nhánh (branch). Bạn có thể xem, sửa, tạo, xóa các nhánh bằng cách dùng lệnh này.
```bash
-# liệt kê các nhanh đang có và ở remote
+# liệt kê các branch đang có và ở remote
$ git branch -a
-# tạo nhánh mới
+# tạo branch mới
$ git branch myNewBranch
-# xóa một nhánh
+# xóa một branch
$ git branch -d myBranch
-# đặt tên lại một nhánh
+# đặt tên lại một branch
# git branch -m <oldname> <newname>
$ git branch -m myBranchName myNewBranchName
-# chỉnh sủa diễn giải của một nhánh
+# chỉnh sửa diễn giải của một branch
$ git branch myBranchName --edit-description
```
### checkout
-Cập nhật tất cả các file torng tree hiện tại để cho trùng khớp với phiên bản của index, hoặc tree cụ thể.
+Cập nhật tất cả các file trong tree hiện tại để cho trùng khớp với phiên bản của index, hoặc tree cụ thể.
```bash
# Checkout (chuyển) một repo - mặc định là nhánh master
@@ -201,8 +202,8 @@ $ git checkout -b newBranch
### clone
Nhân bản, hoặc sao chép, một repo hiện có thành một thư mục mới. Nó cũng thêm
-các nhánh có remote-tracking cho mỗi nhánh trong một repo được nhân bản, mà
-cho phép bạn push đến một nhánh remote.
+các branch có remote-tracking cho mỗi branch trong một repo được nhân bản, mà
+cho phép bạn push đến một remote branch.
```bash
# Nhân bản learnxinyminutes-docs
@@ -211,7 +212,7 @@ $ git clone https://github.com/adambard/learnxinyminutes-docs.git
### commit
-Lưu trữ nội dung hiện tại của index trong một "commit" mới. Điều này cho phép tạo ra thay đổi và một lời nhắn (ghi chú) tạo ra bởi người dùng.
+Lưu trữ nội dung hiện tại của index trong một "commit" mới. Điều này cho phép tạo ra thay đổi và một ghi chú tạo ra bởi người dùng.
```bash
# commit với một ghi chú
@@ -279,7 +280,7 @@ $ git log --merges
"Trộn" các thay đổi từ commit bên ngoài vào trong nhánh hiện tại.
```bash
-# Merge nhánh cụ thể vào nhánh hiện tại.
+# Merge branch cụ thể vào branch hiện tại.
$ git merge branchName
# Luôn khởi tạo một merge commit khi trộn (merge)
@@ -304,30 +305,35 @@ $ git mv -f myFile existingFile
### pull
-Kéo (tải) về từ một repo và merge nó vào nhánh khác.
+Pull về từ một repo và merge nó vào branch khác.
```bash
-# Cập nhật repo cục bộ của bạn, bằng cách merge các thay đổi mới
+# Cập nhật repo local của bạn, bằng cách merge các thay đổi mới
# từ remote "origin" và nhánh "master".
# git pull <remote> <branch>
# git pull => hoàn toàn mặc định như => git pull origin master
$ git pull origin master
-# Merge các thay đổi từ nhánh remote và rebase
-# các commit nhánh lên trên thư mục cục bộ, như: "git pull <remote> <branch>, git rebase <branch>"
+# Merge các thay đổi từ remote branch và rebase
+# các commit trong branch lên trên local repo, như sau: "git pull <remote> <branch>, git rebase <branch>"
$ git pull origin master --rebase
```
### push
-Đẩy và trộn (mege) các tay đổi từ một nhánh đế một remote & nhánh.
-
-```bash
-# Push và merge các thay đổi từ repo cục bộ đến một
-# remote tên là "origin" và nhánh "master".
-# git push <remote> <branch>
-# git push => hoàn toàn defaults to => git push origin master
-$ git push origin master
+push và merge các thay đổi từ một branch đến một remote & branch.
+
+```bash
+# Push và merge các thay đổi từ một repo local đến một
+# remote có tên là "origin" và nhánh "master".
+# git push <remote> <branch>
+# git push => mặc định ẩn đến => git push origin master
+$ git push origin master
+
+# Để liên kết đến một branch local với một branch remote, thêm vào cờ -u:
+$ git push -u origin master
+# Từ lúc này, bất cứ khi nào bạn muốn push từ cùng một nhánh local đó, sử dụng lối tắt:
+$ git push
```
### rebase (thận trọng)
@@ -390,4 +396,8 @@ $ git rm /pather/to/the/file/HelloWorld.c
* [SalesForce Cheat Sheet](https://na1.salesforce.com/help/doc/en/salesforce_git_developer_cheatsheet.pdf)
-* [GitGuys](http://www.gitguys.com/)
+* [GitGuys](http://www.gitguys.com/)
+
+* [Git - the simple guide](http://rogerdudler.github.io/git-guide/index.html)
+
+