summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--c++.html.markdown348
-rw-r--r--c.html.markdown2
-rw-r--r--coffeescript.html.markdown2
-rw-r--r--compojure.html.markdown71
-rw-r--r--css.html.markdown91
-rw-r--r--de-de/css-de.html.markdown179
-rw-r--r--de-de/markdown-de.html.markdown256
-rw-r--r--elixir.html.markdown2
-rw-r--r--erlang.html.markdown14
-rw-r--r--es-es/bash-es.html.markdown1
-rw-r--r--fr-fr/css-fr.html.markdown221
-rw-r--r--go.html.markdown4
-rw-r--r--json.html.markdown2
-rw-r--r--julia.html.markdown7
-rw-r--r--learntmux.html.markdown71
-rw-r--r--markdown.html.markdown8
-rw-r--r--nim.html.markdown265
-rw-r--r--nl-nl/coffeescript-nl.html.markdown109
-rw-r--r--ocaml.html.markdown372
-rw-r--r--perl6.html.markdown167
-rw-r--r--python.html.markdown14
-rw-r--r--python3.html.markdown32
-rw-r--r--tmux.html.markdown244
-rw-r--r--zh-cn/livescript-cn.html.markdown322
-rw-r--r--zh-cn/ruby-cn.html.markdown2
25 files changed, 2547 insertions, 259 deletions
diff --git a/c++.html.markdown b/c++.html.markdown
new file mode 100644
index 00000000..5bf7e2ea
--- /dev/null
+++ b/c++.html.markdown
@@ -0,0 +1,348 @@
+---
+language: c++
+filename: learncpp.cpp
+contributors:
+ - ["Steven Basart", "http://github.com/xksteven"]
+lang: en
+---
+
+I am writing this to highlight the differences and
+additions that C++ has with respect to C. My
+suggestion would be to follow the C tutorial first
+then look here for the additions and differences.
+
+```c++
+///////////////////////////////////////
+// C++ differences
+///////////////////////////////////////
+
+
+//In C++
+//cannot use void main()
+int main() { //or int main(int argc, char **argv)
+ //cannot end with return;
+ return 0;
+ //Can also end without return statement
+}
+
+//In C++
+/*
+ //This could lead to compiler errors and is discouraged
+ //#if 0 #endif pairs are encouraged instead
+*/
+
+//In C++
+sizeof(10) //Typically 4
+sizeof('c') == 1
+
+//In C
+sizeof('c') == sizeof(10) //true chars are passed as ints
+
+
+//In C++ strict prototyping
+void func(); //function which accepts no arguments
+
+//In C
+void func(); //function which may accept arguments
+
+
+//In C++
+for(int i = 0; i < 10; i++) {;}
+//In C must int i must be declared before
+
+
+//C++ Supports Function overloading
+//Provided each function takes different
+//parameters
+
+void printing(char const *myString)
+{printf("String %s\n",myString);} //Hello
+
+void printing(int myInt)
+{printf("My int is %d",myInt);} //15
+
+int main ()
+{
+ printing("Hello");
+ printing(15);
+}
+
+
+
+//C++ Default Function Arguments
+void two_ints(int a = 1, int b = 4);
+
+int main()
+{
+ two_ints(); // arguments: 1, 4
+ two_ints(20); // arguments: 20, 4
+ two_ints(20, 5); // arguments: 20, 5
+}
+
+
+//C++ added the nullptr which is different from 0
+int *ip = nullptr; // OK
+int value = nullptr; // error: value is no pointer
+
+
+///////////////////////////////////////
+// C++ Additions ontop of C
+///////////////////////////////////////
+
+
+///////////////////////////////////////
+// C++ Namespace
+///////////////////////////////////////
+
+//Namespaces allow you to define your own
+//functions and variables for use
+
+// Use '::' to change variable (or function) scope
+// Putting '::' before a function or variable will
+// reference a global scope
+
+// This allows you to make normal c library calls
+// std is for standard library
+using namespace std;
+
+#include <stdio.h>
+
+int counter = 50; // global variable
+
+int main()
+{
+ for (int counter = 1; // this refers to the
+ counter < 2; // local variable
+ counter++)
+ {
+ printf("Global var %d local var %d\n",
+ ::counter, // global variable
+ counter); // local variable
+ // => Global var 50 local var 1
+ }
+}
+
+// Namespaces can be nested
+
+
+namespace myFirstNameSpace
+{
+ namespace myInnerSoul
+ {
+ cos(int x)
+ {
+ printf("My inner soul was made to program.");
+ }
+ }
+}
+
+namespace anotherNameSpace
+{
+ cos(int x) {;} //does nothing
+}
+
+int main()
+{
+ //Specify the full path because main is outside of both namespaces.
+ //Will print out My inner soul was made to program.
+ myFirstNameSpace::myInnerSoul::cos(60);
+}
+
+
+///////////////////////////////////////
+// C++ Strings
+///////////////////////////////////////
+
+//Strings in C++ are Objects and have many functions
+myString = "Hello";
+myOtherString = " World";
+
+myString + myOtherString; // => "Hello World"
+
+myString + ' You'; // => "Hello You"
+
+myString != myOtherString; //True
+
+//An example of a string method
+myString.append(" Dog"); // => "Hello Dog"
+
+
+///////////////////////////////////////
+// C++ Input Output
+///////////////////////////////////////
+
+//C++ input and output streams
+//cin, cout, cerr, << is insertion and >> is extraction operator
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+
+ int myInt;
+
+ //Prints to stdout (or terminal/screen)
+ cout << "Enter your fav number:\n";
+ //Takes in input
+ cin >> myInt;
+
+ //cout can also be formatted
+ cout << "Your fav number is " << myInt << "\n";
+ //Your fav number is ##
+
+ cerr << "Used for error messages";
+}
+
+
+///////////////////////////////////////
+// C++ Classes
+///////////////////////////////////////
+
+
+//First example of classes
+#include <iostream>
+
+//define a class
+class Doggie
+{
+ std::string name;
+ int weight;
+
+ // These are only the declarations
+ //Can also have private and protected
+ public:
+ //The public methods (can also include variables)
+
+ // Default constructor
+ Doggie();
+
+ void setName(std::string dogsName);
+ void setWeight(int dogsWeight);
+ void printDog();
+
+ //Can define functions within class declaration too
+ void dogBark() {std::cout << "Bark Bark\n"}
+
+ //Destructors are methods that free the allocated space
+ ~doggieDestructor();
+ //if no destructor compiler defines the trivial destructor
+
+//Classes are similar to structs and must close the } with ;
+};
+
+// This is the implementation of the class methods
+// Also called the definition
+void Doggie::Doggie () {
+ std::cout << "A doggie is born. Woof!\n";
+}
+
+void Doggie::setName (std::string doggie_name) {
+ name = doggie_name;
+}
+
+void Doggie::setWeight (int doggie_weight) {
+ weight = doggie_weight;
+}
+
+void Doggie::printDog () {
+ std::cout << "Dog is " << name << " weighs" << weight << "\n";
+}
+
+void Doggie::~doggieDestructor () {
+ delete[] name;
+ delete weight;
+}
+
+int main () {
+ Doggie deedee; // prints out a doggie is born. Woof!
+ deedee.setName ("Barkley");
+ deedee.setWeight(1000000);
+ deedee.printDog;
+ //prints => Dog is Barkley weighs 1000000
+ return 0;
+}
+
+
+//C++ Class inheritance
+
+class German_Sheperd : public Doggie
+{
+ //This class now inherits everything public and protected from Doggie class
+
+ //Good practice to put d_ in front of datatypes in classes
+ std::string d_type;
+
+ public:
+ void dogType() {d_type = "German Sheperd";}
+};
+
+
+
+///////////////////////////////////////
+// C++ Exception Handling
+///////////////////////////////////////
+
+try {
+ throw 12.25; // throws a double no handler declared
+} catch (int errorNum)
+{
+ std::cout << "I caught an int " << errorNum << "\n";
+//default catcher
+} catch (...)
+{
+ std::cout << "I got an error. Not sure what but I can pass it up.";
+ throw;
+}
+
+
+///////////////////////////////////////
+// C++ Operator Overloading
+///////////////////////////////////////
+
+// In C++ you can overload operators such as +, -, new, etc.
+
+#include <iostream>
+using namespace std;
+
+class Vector {
+ public:
+ double x,y;
+ Vector () {};
+ Vector (double a, double b) : x(a), y(b) {}
+ Vector operator + (const CVector&);
+ Vector operator += (const CVector&);
+};
+
+Vector Vector::operator+ (const Vector& rhs)
+{
+ Vector temp;
+ temp.x = x + rhs.x;
+ temp.y = y + rhs.y;
+ return temp;
+}
+
+Vector Vector::operator+= (const Vector& rhs)
+{
+ x += rhs.x;
+ y += rhs.y;
+ return *this;
+}
+
+int main () {
+ Vector up (0,1);
+ Vector right (1,0);
+ Vector result;
+ // This calls the Vector + operator
+ // Vector up calls the + (function) with right as its paramater
+ result = up + right;
+ // prints out => Result is upright (1,1)
+ cout << "Result is upright (" << result.x << ',' << result.y << ")\n";
+ return 0;
+}
+
+```
+Futher Reading
+
+for more resources see: http://www.icce.rug.nl/documents/cplusplus/
+for other reference material: http://www.cplusplus.com/doc/tutorial/
diff --git a/c.html.markdown b/c.html.markdown
index cbb6d289..10e6fa45 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -217,7 +217,7 @@ int main() {
int e = 5;
int f = 10;
int z;
- z = (a > b) ? a : b; // => 10 "if a > b return a, else return b."
+ z = (e > f) ? e : f; // => 10 "if e > f return e, else return f."
//Increment and decrement operators:
char *s = "iLoveC";
diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown
index 6af692b9..4c080bc6 100644
--- a/coffeescript.html.markdown
+++ b/coffeescript.html.markdown
@@ -20,7 +20,7 @@ See also [the CoffeeScript website](http://coffeescript.org/), which has a compl
Block comments are like these, and they translate directly to '/ *'s and '* /'s
for the resulting JavaScript code.
-You should understand most of JavaScript semantices
+You should understand most of JavaScript semantics
before continuing.
###
diff --git a/compojure.html.markdown b/compojure.html.markdown
index 96555273..36a8d123 100644
--- a/compojure.html.markdown
+++ b/compojure.html.markdown
@@ -102,35 +102,78 @@ You can adjust what each parameter matches by supplying a regex:
```clojure
(defroutes myapp
(GET ["/file/:name.:ext" :name #".*", :ext #".*"] [name ext]
- (str "File: " name ext))
+ (str "File: " name ext)))
```
-Handlers may utilize query parameters:
+### Middleware
+
+Clojure uses [Ring](https://github.com/ring-clojure/ring) for routing.
+Handlers are just functions that accept a request map and return a
+response map (Compojure will turn strings into 200 responses for you).
+
+You can easily write middleware that wraps all or part of your
+application to modify requests or responses:
+
+```clojure
+(defroutes myapp
+ (GET "/" req (str "Hello World v" (:app-version req))))
+
+(defn wrap-version [handler]
+ (fn [request]
+ (handler (assoc request :app-version "1.0.1"))))
+
+(defn -main []
+ (run-server (wrap-version myapp) {:port 5000}))
+```
+
+[Ring-Defaults](https://github.com/ring-clojure/ring-defaults) provides some handy
+middlewares for sites and apis, so add it to your dependencies:
+
+```
+[ring/ring-defaults "0.1.1"]
+```
+
+Then, you can import it in your ns:
+
+```
+(ns myapp.core
+ (:require [compojure.core :refer :all]
+ [ring.middleware.defaults :refer :all]
+ [org.httpkit.server :refer [run-server]]))
+```
+
+And use `wrap-defaults` to add the `site-defaults` middleware to your
+app:
+
+```
+(defn -main []
+ (run-server (wrap-defaults myapp site-defaults) {:port 5000}))
+```
+
+Now, your handlers may utilize query parameters:
```clojure
(defroutes myapp
- (GET "/posts" []
- (fn [req]
- (let [title (get (:params req) "title")
- author (get (:params req) "title")]
- " Do something with title and author"))))
+ (GET "/posts" req
+ (let [title (get (:params req) "title")
+ author (get (:params req) "author")]
+ (str "Title: " title ", Author: " author))))
```
-Or, for POST and PUT requests, form parameters
+Or, for POST and PUT requests, form parameters as well
```clojure
(defroutes myapp
- (POST "/posts" []
- (fn [req]
- (let [title (get (:params req) "title")
- author (get (:params req) "title")]
- "Do something with title and author"))))
+ (POST "/posts" req
+ (let [title (get (:params req) "title")
+ author (get (:params req) "author")]
+ (str "Title: " title ", Author: " author))))
```
### Return values
-The return value of a route block determines at least the response body
+The return value of a route block determines the response body
passed on to the HTTP client, or at least the next middleware in the
ring stack. Most commonly, this is a string, as in the above examples.
But, you may also return a [response map](https://github.com/mmcgrana/ring/blob/master/SPEC):
diff --git a/css.html.markdown b/css.html.markdown
index cdef50cc..e058d691 100644
--- a/css.html.markdown
+++ b/css.html.markdown
@@ -3,6 +3,7 @@ language: css
contributors:
- ["Mohammad Valipour", "https://github.com/mvalipour"]
- ["Marco Scannadinari", "https://github.com/marcoms"]
+ - ["Geoffrey Liu", "https://github.com/g-liu"]
filename: learncss.css
---
@@ -24,18 +25,19 @@ The main focus of this article is on the syntax and some general tips.
```css
-/* comments appear inside slash-asterisk, just like this line! */
+/* comments appear inside slash-asterisk, just like this line!
+ there are no "one-line comments"; this is the only comment style */
/* ####################
## SELECTORS
- ####################*/
+ #################### */
/* Generally, the primary statement in CSS is very simple */
selector { property: value; /* more properties...*/ }
/* the selector is used to target an element on page.
-You can target all elments on the page! */
+You can target all elments on the page using asterisk! */
* { color:red; }
/*
@@ -62,61 +64,61 @@ div { }
/* or that the attribute has a specific value */
[attr='value'] { font-size:smaller; }
-/* start with a value*/
+/* start with a value (CSS3) */
[attr^='val'] { font-size:smaller; }
-/* or ends with */
+/* or ends with (CSS3) */
[attr$='ue'] { font-size:smaller; }
-/* or even contains a value */
+/* or even contains a value (CSS3) */
[attr~='lu'] { font-size:smaller; }
/* and more importantly you can combine these together -- there shouldn't be
-any spaaace between different parts because that makes it to have another
-meaning.*/
+any space between different parts because that makes it to have another
+meaning. */
div.some-class[attr$='ue'] { }
-/* you can also select an element based on its parent.*/
+/* you can also select an element based on its parent. */
-/*an element which is direct child of an element (selected the same way) */
+/* an element which is direct child of an element (selected the same way) */
div.some-parent > .class-name {}
-/* or any of its parents in the tree */
-/* the following basically means any element that has class "class-name"
-and is child of a div with class name "some-parent" IN ANY DEPTH */
+/* or any of its parents in the tree
+ the following basically means any element that has class "class-name"
+ and is child of a div with class name "some-parent" IN ANY DEPTH */
div.some-parent .class-name {}
/* warning: the same selector wihout spaaace has another meaning.
-can you say what? */
+ can you say what? */
div.some-parent.class-name {}
/* you also might choose to select an element based on its direct
-previous sibling */
+ previous sibling */
.i-am-before + .this-element { }
-/*or any sibling before this */
+/* or any sibling before this */
.i-am-any-before ~ .this-element {}
/* There are some pseudo classes that allows you to select an element
-based on its page behaviour (rather than page structure) */
+ based on its page behaviour (rather than page structure) */
/* for example for when an element is hovered */
-:hover {}
+selector:hover {}
-/* or a visited link*/
-:visited {}
+/* or a visited link */
+selected:visited {}
-/* or not visited link*/
-:link {}
+/* or not visited link */
+selected:link {}
/* or an input element which is focused */
-:focus {}
+selected:focus {}
/* ####################
## PROPERTIES
- ####################*/
+ #################### */
selector {
@@ -126,8 +128,12 @@ selector {
width: 200px; /* in pixels */
font-size: 20pt; /* in points */
width: 5cm; /* in centimeters */
- width: 50mm; /* in millimeters */
- width: 5in; /* in inches */
+ min-width: 50mm; /* in millimeters */
+ max-width: 5in; /* in inches. max-(width|height) */
+ height: 0.2vh; /* times vertical height of browser viewport (CSS3) */
+ width: 0.4vw; /* times horizontal width of browser viewport (CSS3) */
+ min-height: 0.1vmin; /* the lesser of vertical, horizontal dimensions of browser viewport (CSS3) */
+ max-width: 0.3vmax; /* same as above, except the greater of the dimensions (CSS3) */
/* Colors */
background-color: #F6E; /* in short hex */
@@ -135,16 +141,20 @@ selector {
background-color: tomato; /* can be a named color */
background-color: rgb(255, 255, 255); /* in rgb */
background-color: rgb(10%, 20%, 50%); /* in rgb percent */
- background-color: rgba(255, 0, 0, 0.3); /* in semi-transparent rgb */
+ background-color: rgba(255, 0, 0, 0.3); /* in semi-transparent rgb (CSS3) */
+ background-color: transparent; /* see thru */
+ background-color: hsl(0, 100%, 50%); /* hsl format (CSS3). */
+ background-color: hsla(0, 100%, 50%, 0.3); /* Similar to RGBA, specify opacity at end (CSS3) */
+
/* Images */
- background-image: url(/path-to-image/image.jpg);
+ background-image: url(/path-to-image/image.jpg); /* quotes inside url() optional */
/* Fonts */
font-family: Arial;
- font-family: "Courier New"; /* if name has spaaace it appears in double-quote */
- font-family: "Courier New", Trebuchet, Arial; /* if first one was not found
- browser uses the second font, and so forth */
+ font-family: "Courier New"; /* if name has spaaace it appears in single or double quotes */
+ font-family: "Courier New", Trebuchet, Arial, sans-serif; /* if first one was not found
+ browser uses the second font, and so forth */
}
```
@@ -155,17 +165,17 @@ Save any CSS you want in a file with extension `.css`.
```xml
<!-- you need to include the css file in your page's <head>: -->
-<link rel='stylesheet' type='text/css' href='filepath/filename.css' />
+<link rel='stylesheet' type='text/css' href='path/to/style.css' />
<!-- you can also include some CSS inline in your markup. However it is highly
recommended to avoid this. -->
<style>
- selector { property:value; }
+ a { color: purple; }
</style>
<!-- or directly set CSS properties on the element.
This has to be avoided as much as you can. -->
-<div style='property:value;'>
+<div style="border: 1px solid red;">
</div>
```
@@ -207,27 +217,28 @@ The precedence of style is as followed:
Remember, the precedence is for each **property**, not for the entire block.
* `E` has the highest precedence because of the keyword `!important`.
- It is recommended to avoid this unless it is strictly necessary to use.
+ It is recommended to avoid this unless it is strictly necessary to use.
* `F` is next, because it is inline style.
* `A` is next, because it is more "specific" than anything else.
- more specific = more specifiers. here 3 specifiers: 1 tagname `p` +
- class name `class1` + 1 attribute `attr='value'`
+ more specific = more specifiers. here 3 specifiers: 1 tagname `p` +
+ class name `class1` + 1 attribute `attr='value'`
* `C` is next. although it has the same specificness as `B`
- but it appears last.
+ but it appears last.
* Then is `B`
* and lastly is `D`.
## Compatibility
Most of the features in CSS2 (and gradually in CSS3) are compatible across
-all browsers and devices. But it's always vital to have in mind the compatiblity
+all browsers and devices. But it's always vital to have in mind the compatiblity
of what you use in CSS with your target browsers.
[QuirksMode CSS](http://www.quirksmode.org/css/) is one of the best sources for this.
+To run a quick compatibility check, [CanIUse](http://caniuse.com) is a great resource.
+
## Further Reading
* [Understanding Style Precedence in CSS: Specificity, Inheritance, and the Cascade](http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/)
* [QuirksMode CSS](http://www.quirksmode.org/css/)
* [Z-Index - The stacking context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context)
-
diff --git a/de-de/css-de.html.markdown b/de-de/css-de.html.markdown
index 8909b251..23c1df94 100644
--- a/de-de/css-de.html.markdown
+++ b/de-de/css-de.html.markdown
@@ -8,107 +8,106 @@ lang: de-de
filename: learncss-de.css
---
-In den frühen Tagen des Internets gab es keine visuellen Elemente, alles war nur reiner Text. Aber mit der Weiterentwickliung von Browsern wurden auch vollständig visuelle Webseiten zu einem Standard.
-CSS ist die allgemeine Sprache, die dazu da ist, damit man den HTML-Code und die Designelemente von Webseiten (strikt) unterscheiden kann.
+In den frühen Tagen des Internets gab es keine visuellen Elemente, alles war nur reiner Text. Aber mit der Weiterentwicklung von Browsern wurden auch vollständig visuelle Webseiten zu einem Standard.
+Durch Verwendung von CSS lässt sich eine strikte Trennung zwischen HTML-Code und Designelementen erreichen.
-Kurzgefasst, CSS ermöglicht es, verschiedene HTML-Elemente anzuvisieren und ihnen stilistische Eigenschaften zu geben.
+Kurzgefasst, CSS ermöglicht es, verschiedene HTML-Elemente innerhalb eines Dokuments auszuwählen und ihnen visuelle Eigenschaften zu geben.
CSS hat wie jede andere Sprache viele Versionen. Hier fokussieren wir uns auf CSS2.0, welche nicht die neueste, aber die am weitesten verbreitete und unterstützte Version ist.
-**NOTE:** Weil die Ausgabe von CSS visuelle Eigenschaften sind, wirst du wahrscheinlich eine CSS-Sandbox wie [dabblet](http://dabblet.com/) benutzen müssen, um die Sprache richtig zu lernen.
+**HINWEIS:** Weil die Ausgabe von CSS visuelle Eigenschaften sind, wirst du wahrscheinlich eine CSS-Sandbox wie [dabblet](http://dabblet.com/) benutzen müssen, um die Sprache richtig zu lernen.
In diesem Artikel wird am meisten auf generelle Hinweise und die Syntax geachtet.
```css
-/* kommentare werden in sternchen-schrägstrichkombinationen gepackt (genauso wie hier!) */
+/* Kommentare werden in Sternchen-Schrägstrichkombinationen gepackt (genauso wie hier!) */
/* ####################
## SELEKTOREN
####################*/
-/* Eigentlich ist die häufigste Anwendungsweise von CSS sehr simpel */
+/* Eigentlich ist das grundlegende CSS-Statement sehr simpel */
selektor { eigenschaft: wert; /* mehr eigenschaften...*/ }
-/* der selektor wird dazu benutzt, ein element auf der seite anzuvisieren
+/* Der Selektor wird dazu benutzt, ein Element auf der Seite auszuwählen.
-Aber man kann auch alle Elemente auf einer Seite anvisieren! */
+Man kann aber auch alle Elemente auf einer Seite auswählen! */
* { color:red; } /* farbe:rot */
/*
-Wenn wir so ein Element auf einer Seite haben:
+Angenommen wir haben folgendes Element auf einer Seite:
<div class='eine-klasse klasse2' id='eineId' attr='wert' />
*/
-/* kann man es so bei seiner klasse anvisieren */
+/* kann man es so über seine Klasse auswählen */
.eine-klasse { }
-/*oder bei beiden klassen! */
+/* oder über beide Klassen! */
.eine-klasse.klasse2 { }
-/* oder beim namen des tags */
+/* oder über den Namen des Tags */
div { }
-/* oder bei seiner id */
+/* oder über seine Id */
#eineId { }
-/* oder daran, dass es ein Attribut hat! */
+/* oder darüber, dass es ein Attribut hat! */
[attr] { font-size:smaller; }
-/* oder daran, dass das attribut einen bestimmten wert hat*/
+/* oder auch darüber, dass das Attribut einen bestimmten Wert hat */
[attr='wert'] { font-size:smaller; }
-/* beginnt mit einem wert*/
-[attr^='wert'] { font-size:smaller; }
+/* beginnt mit dem übergebenen Wert */
+[attr^='we'] { font-size:smaller; }
-/* oder endet mit */
+/* endet damit */
[attr$='rt'] { font-size:smaller; }
-/* oder sogar nur beinhaltet */
+/* oder beinhaltet einen Teil davon */
[attr~='er'] { font-size:smaller; }
-/* was aber noch wichtiger ist, ist dass man alle diese kombinieren
-kann - man sollte nur mit der leerzeichensetzung vorsichtig sein,
-da es mit einem leerzeichen zwei verschiedene selektoren wären*/
+/* Noch wichtiger ist aber die Möglichkeit, all das miteinander kombinieren
+zu können - man sollte hierbei nur mit der Leerzeichensetzung vorsichtig sein,
+ein Leerzeichen macht es zu zwei verschiedenen Selektoren */
+
div.eine-klasse[attr$='rt'] { } /* so ist es richtig */
-/* man kann auch ein element daran festmachen, wie sich die übergeordneten
-elemente verhalten!*/
+/* Man kann auch ein Element über seine Elternelemente auswählen */
-/*es muss allerdings ein direktes kind sein */
+/* > wählt ein direktes Kind aus */
div.ein-elternteil > .klassen-name {}
-/* oder jeder seiner eltern in der struktur */
-/* das folgende heißt also, dass jedes element mit der klasse 'klassen-name'
-und dem elternteil IN JEDER TIEFE ausgewählt wird */
+/* Mit einem Leerzeichen getrennt kann man alle Elternelemente ansprechen */
+/* Das folgende heißt also, dass jedes Element mit der Klasse 'klassen-name'
+und dem Elternteil IN JEDER TIEFE ausgewählt wird */
div.ein-elternteil .klassen-name {}
-/* achtung: dasselbe ohne das leerzeichen hat eine andere bedeutung,
+/* Achtung: das selbe ohne das Leerzeichen hat eine andere Bedeutung,
kannst du mir sagen, was? */
div.ein-elternteil.klassen-name {}
-/* man kann auch ein element nach seinem direkten vorherigen zwilling
+/* Man kann ein Element auch nach seinem direkten Nachbarelement
auswählen */
.ich-bin-vorher + .dieses-element { }
-/* oder jeden zwilling davor */
+/* Oder über jedes Geschwisterelement davor */
.ich-kann-jeder-davor-sein ~ .dieses-element {}
-/* es gibt ein paar pseudoklassen, die sich basierend auf dem
-seitenverhalten, nämlich nicht auf der seitenstruktur auswählen
-lassen können */
+/* Mit Pseudoklassen lassen sich Elemente anhand ihres momentanen Zustands
+auf der Seite auswählen (anstatt über die Seitenstruktur) */
-/* zum beispiel, wenn über ein element mit dem mauszeiger gefahren wird */
+/* Zum Beispiel, wenn über ein Element mit dem Mauszeiger gefahren wird */
:hover {}
-/* oder einen bereits besuchten link*/
+/* Oder einen bereits besuchten Link*/
:visited {}
-/* oder einen noch nicht besuchten link*/
+/* Oder einen noch nicht besuchten Link*/
:link {}
-/* oder ein eingabeelement, das zurzeit im fokus steht */
+/* Oder ein Eingabeelement, das zurzeit im Fokus steht */
:focus {}
@@ -117,64 +116,64 @@ lassen können */
####################*/
selector {
-
- /* einheiten */
- width: 50%; /* in prozent */
- font-size: 2em; /* mal der derzeitigen schriftgröße */
- width: 200px; /* in pixeln */
- font-size: 20pt; /* in punkten */
- width: 5cm; /* in zentimetern */
- width: 50mm; /* in millimetern */
- width: 5in; /* in zoll */
-
- /* farben */
- background-color: #F6E /* in kurzem hex */
- background-color: #F262E2 /* in langem hex */
- background-color: tomato /* kann auch eine genannte farbe sein */
- background-color: rgb(255, 255, 255) /* in rgb */
- background-color: rgb(10%, 20%, 50%) /* in rgb prozent */
- background-color: rgba(255, 0, 0, 0.3); /* in semi-transparentem rgb */
-
- /* bilder */
+
+ /* Einheiten */
+ width: 50%; /* in Prozent */
+ font-size: 2em; /* mal der derzeitigen Schriftgröße */
+ width: 200px; /* in Pixeln */
+ font-size: 20pt; /* in Punkten */
+ width: 5cm; /* in Zentimetern */
+ width: 50mm; /* in Millimetern */
+ width: 5in; /* in Zoll */
+
+ /* Farben */
+ background-color: #F6E /* in kurzem Hex */
+ background-color: #F262E2 /* in langem Hex */
+ background-color: tomato /* kann auch eine benannte Farbe sein */
+ background-color: rgb(255, 255, 255) /* in RGB */
+ background-color: rgb(10%, 20%, 50%) /* in RGB Prozent */
+ background-color: rgba(255, 0, 0, 0.3); /* in semi-transparentem RGB */
+
+ /* Bilder */
background-image: url(/pfad-zum-bild/image.jpg);
-
- /* schriften */
+
+ /* Schriften */
font-family: Arial;
- font-family: "Courier New"; /* wenn der name ein leerzeichen beinhält, kommt er in
- apostrophe */
- font-family: "Courier New", Trebuchet, Arial; /* wenn der erste nicht gefunden wird, wird
- der zweite benutzt, und so weiter */
+ font-family: "Courier New"; /* wenn der Name ein Leerzeichen beinhält, kommt er in
+ Anführungszeichen */
+ font-family: "Courier New", Trebuchet, Arial; /* wird die erste Schriftart
+ nicht gefunden, wird die zweite benutzt, usw. */
}
```
## Benutzung
-speichere das css, das du benutzen willst mit der endung '.css'.
+Speichere das CSS, das du benutzen willst mit der endung '.css'.
```xml
-<!-- du musst die css-datei im <head>-bereich der seite erwähnen -->
+<!-- du musst die CSS-Datei im <head>-bereich der seite einbinden -->
<link rel='stylesheet' type='text/css' href='filepath/filename.css' />
-<!-- es geht allerdings auch direkt, wobei diese methode nicht
+<!-- Einbindung funktioniert auch inline, wobei diese Methode nicht
empfohlen ist -->
<style>
selector { property:value; }
</style>
-<!-- oder direkt am element (sollte aber gelassen werden) -->
+<!-- Oder direkt auf einem Element (sollte aber vermieden werden) -->
<div style='property:value;'>
</div>
```
-## Wichtigkeit
+## Spezifität
-ein element kann von mehr als einem selektoren angezielt werden.
-und kann auch eine eigenschaft mehr als einmal zugewiesen bekommen.
-in diesen fällen gibt es regeln, die die wichtigkeit von selektoren einführen.
+Ein Element kann natürlich auch von mehr als einer Regel in einem Stylesheet
+angesprochen werdenm und kann eine Eigenschaft auch öfters als einmal zugewiesen
+bekommen. In diesen Fällen gibt es Regeln, die die Spezifität von Selektoren regeln.
-wie haben dieses CSS:
+Wir haben dieses CSS:
```css
/*A*/
@@ -194,34 +193,34 @@ p { property: wert !important; }
```
-und das folgende markup:
+und das folgende Markup:
```xml
<p style='/*F*/ property:value;' class='class1 class2' attr='value'>
</p>
```
-die wichtigkeit der stile ist wie folgt:
-(die wichtigkeit gilt nur für **eigenschaften**, nicht für ganze blöcke)
-
-* `E` hat die größte wichtigkeit wegen dem schlüsselwort `!important`.
- man sollte diese form aber vermeiden.
-* `F` ist als nächstes, da es direkt an dem element definiert ist.
-* `A` ist als nächstes, da es "spezifischer" als alle anderen ist.
- spezifischer = mehr zuweisungen: 1 tagname `p` +
- klassenname `klasse1` + 1 attribut `attr='value'`
-* `C` ist als nächstes obwohl es genau so ist wie `B`
- aber es erscheint als letztes.
-* dann ist `B`
+Die Spezifität der Stile ist wie folgt:
+(die Spezifität gilt nur für **einzelne Eigenschaften**, nicht für ganze Blöcke)
+
+* `E` hat die größte Spezifität wegen dem Schlüsselwort `!important`.
+ man sollte diese Form aber vermeiden.
+* `F` ist als nächstes dran, da es direkt an dem element definiert ist.
+* Dann folgt `A`, da es "spezifischer" als alle anderen ist.
+ spezifischer = mehr Zuweisungen: 1 Tagname `p` +
+ Klassenname `klasse1` + 1 Attribut `attr='value'`
+* `C` kommt als nächstes, obwohl es genau so ist wie `B`,
+ es erscheint aber später im Stylesheet.
+* dann kommt `B`
* und als letztes `D`.
-## Kompabilität
+## Kompatibilität
-die meisten features von CSS sind in allen browsern verfügbar.
-man sollte jedoch immer darauf achten, wenn man etwas mit CSS
-programmiert.
+Die meisten Features von CSS sind in allen Browsern verfügbar. Man sollte
+jedoch immer darauf achten die benutzten Features auf Verfügbarkeit in den
+vom Projekt unterstützten Browser zu überprüfen.
-[QuirksMode CSS](http://www.quirksmode.org/css/) ist eine der besten quellen dafür.
+[QuirksMode CSS](http://www.quirksmode.org/css/) oder [Can I Use](http://caniuse.com/) sind zwei der besten Quellen dafür.
## Weiterlesen
diff --git a/de-de/markdown-de.html.markdown b/de-de/markdown-de.html.markdown
new file mode 100644
index 00000000..6a90980b
--- /dev/null
+++ b/de-de/markdown-de.html.markdown
@@ -0,0 +1,256 @@
+---
+language: markdown
+contributors:
+ - ["Dan Turkel", "http://danturkel.com/"]
+translators :
+ - ["Frederik Ring", "https://github.com/m90"]
+ - ["Philipp Fischbeck", "https://github.com/PFischbeck"]
+filename: markdown-de.md
+lang: de-de
+---
+
+Markdown wurde im Jahr 2004 von John Gruber kreiert. Ziel ist und war eine
+Syntax, in der sich Dokumente leicht schreiben *und* lesen lassen. Außerdem
+sollte Markdown sich leicht nach HTML (und in andere Formate) konvertieren
+lassen.
+
+```markdown
+<!-- Markdown ist eine Obermenge von HTML - jede valide HTML-Datei ist also
+automatisch valides Markdown - was heisst dass wir jedes HTML-Element (also auch
+Kommentare) in Markdown benutzen können, ohne dass der Parser sie verändert.
+Jedoch kann man innerhalb eines solchen HTML-Elements dann kein Markdown
+mehr verwenden. -->
+
+<!-- Es existieren unterschiedliche Markdown-Parser und -Dialekte, die sich in
+manchen Punkten unterscheiden. Diese Einführung wird versuchen, zu erläutern,
+welche Features überall verfügbar sind, und welche davon parser-spezifisch sind -->
+
+<!-- Überschriften -->
+<!-- HTML-Überschriften <h1> bis <h6> lassen sich einfach durch ein Voranstellen
+der entsprechenden Anzahl an Hashes (#) auszeichnen -->
+# Das ist eine <h1>
+## Das ist eine <h2>
+### Das ist eine <h3>
+#### Das ist eine <h4>
+##### Das ist eine <h5>
+###### Das ist eine <h6>
+
+<!-- Für die Elemente <h1> und <h2> gibt es in Markdown noch Sonderformen -->
+Das ist eine h1
+=============
+
+Das ist eine h2
+-------------
+
+<!-- Einfaches Textstyling -->
+<!-- Jeglicher Text lässt sich mit Markdown leicht als kursiv oder
+auch als fett auszeichnen -->
+
+*Dieser Text ist kursiv.*
+_Genau wie dieser._
+
+**Dieser Text ist fett.**
+__Genau wie dieser.__
+
+***Dieser Text ist beides***
+**_Dieser auch!_**
+*__Und dieser genau so!__*
+
+<!-- In "Github Flavored Markdown", dem von Github verwendeten Dialekt / Parser,
+gibt es auch noch durchgestrichenen Text: -->
+
+~~Dieser Text wird durchgestrichen dargestellt.~~
+
+<!-- Absätze sind eine oder mehrere zusammenhängende Zeilen Text, und werden
+durch eine oder mehrere Leerzeilen voneinander abgesetzt. -->
+
+Das ist ein Absatz. Ich kann immer noch nicht glauben, wie viel Spaß das macht !?!
+
+Jetzt bin ich schon bei Absatz 2.
+Hier ist dann immer noch Absatz 2!
+
+
+Jetzt ist das dann Nummer drei!
+
+<!-- Sollte man jemals ein <br />-Tag einfügen wollen, kann man einen Absatz
+mit zwei oder mehr Leerzeichen beenden, und danach einen neuen Absatz beginnen. -->
+
+Ich höre mit zwei Leerzeichen auf (markiere mich, und du siehst es).
+
+Über mir ist wohl ein <br />!
+
+<!-- Zitate werden ganz einfach mit einem > ausgezeichnet. -->
+
+> Das ist ein Zitat. Du kannst Zeilenumbrüche
+> entweder manuell hinzufügen und ein `>` vor jeder Zeile einfügen, oder du kannst deine Zeilen einfach immer länger und länger werden lassen, die Umbrüche werden dann automatisch erzeugt.
+> Solange sie mit einem `>` beginnen, macht das keinen Unterschied.
+
+> Auch möglich ist es, den Text
+>> mehrstufig einzurücken.
+> Nicht schlecht, oder?
+
+<!-- Listen -->
+<!-- <ul>s können mit Sternen, Pluszeichen oder Minuszeichen erzeugt werden -->
+
+* Punkt auf der Liste
+* Punkt auf der Liste
+* Anderer Punkt auf der Liste
+
+oder
+
++ Punkt auf der Liste
++ Punkt auf der Liste
++ Noch ein Punkt auf der Liste
+
+oder
+
+- Punkt auf der Liste
+- Punkt auf der Liste
+- Ein letzter Punkt auf der Liste
+
+<!-- <ol>s werden mit einer Zahl gefolgt von einem Punkt erzeugt -->
+
+1. Punkt eins
+2. Punkt zwei
+3. Punkt drei
+
+<!-- Auch wenn es keine gute Idee sein mag: du müsstest die einzelnen Punkte
+nicht mal korrekt numerieren -->
+
+1. Punkt eins
+1. Punkt zwei
+1. Punkt drei
+<!-- (Das sieht genau so aus wie das Beispiel eins weiter oben) -->
+
+<!-- Man kann Listen auch verschachteln -->
+
+1. Punkt eins
+2. Punkt zwei
+3. Punkt drei
+ * Unterpunkt
+ * Unterpunkt
+4. Punkt vier
+
+<!-- Code-Blöcke -->
+<!-- Blöcke von Programmcode (also ein <code>-Element) kannst du auszeichnen,
+indem du eine Zeile mit vier Leerzeichen oder einem Tabulator einrückst -->
+
+ Das ist Quellcode
+ Das hier auch
+
+<!-- Der Code kann natürlich auch wiederum eingerückt sein -->
+
+ my_array.each do |item|
+ puts item
+ end
+
+<!-- Innerhalb normalen Texts kannst du Code mit Backticks ` auszeichnen -->
+
+Hermann hatte nicht die leiseste Ahnung, was dieses `go_to()` bedeuten könnte!
+
+<!-- In "Github Flavored Markdown" gibt es für Code nocheinmal eine
+besondere Syntax -->
+
+\`\`\`ruby <!-- in "echt" musst du die Backslashes entfernen: ```ruby ! -->
+def foobar
+ puts "Hallo Welt!"
+end
+\`\`\` <!-- hier auch keine Backslashes, nur ``` -->
+
+<-- der obige Block muss nicht extra eingerückt werden, außerdem fügt Github
+Syntax-Highlighting für die nach dem ``` angegebene Sprache hinzu -->
+
+<!-- Horizontale Linie (<hr />) -->
+<!-- Trenner lassen sich einfach mit drei (oder mehr) Sternen oder Bindestrichen
+erzeugen (egal ob mit oder ohne Leerzeichen dazwischen)-->
+
+***
+---
+- - -
+****************
+
+<!-- Hyperlinks -->
+<!-- Eines der besten Features von Markdown ist das kinderleichte Erzeugen von
+Hyperlinks: Einfach den Linktext in eckige Klammern [] setzen, gefolgt von
+einer mit runden Klammern () umschlossenen URL. -->
+
+[Klick mich!](http://test.de/)
+
+<!-- Man kann dem Link auch noch ein title-Attribut geben -->
+
+[Klick mich!](http://test.at/ "Link zu Test.at")
+
+<!-- Relative Pfade funktionieren natürlich auch -->
+
+[Zu meiner Musiksammlung](/music/).
+
+<!-- URLs lassen sich auch über Referenzen festlegen -->
+
+[Klick mich][link1], um mehr über mich herauszufinden!
+[Hier kannst du auch mal draufklicken][foobar], wenn es dich interessiert.
+
+[link1]: http://test.de/ "Wahnsinn!"
+[foobar]: http://foobar.ch/ "Erstaunlich!"
+
+<!-- Das title-Attribut wird entweder mit Anführungszeichen oder Klammern
+umschlossen (oder gleich ganz weggelassen). Die Referenzen können an jeder
+Stelle im gesamtem Dokument vorkommen, als ID kann alles verwendet werden, solange
+es dokumentweit eindeutig ist. -->
+
+<!-- Man kann den Linktext auch als implizite Referenz benutzen -->
+
+[Das][] ist ein Link.
+
+[das]: http://dasisteinlink.at/
+
+<!-- Das ist aber eher unüblich. -->
+
+<!-- Bilder -->
+<!-- Bilder funktionieren genau wie Links, nur dass man noch ein Ausrufezeichen
+voranstellt! -->
+
+![Das ist das alt-Attribut für mein Bild](http://imgur.com/myimage.jpg "Hier noch ein title-Attribut")
+
+<!-- Referenzen funktionieren auch hier genau wie erwartet -->
+
+![Das ist das alt-Attribut][meinbild]
+
+[meinbild]: relative/urls/gehen/auch.jpg "hier wäre noch Platz für einen title"
+
+<!-- Bonusfeatures -->
+<!-- Auto-Links -->
+
+<http://testwebseite.de/> ist das selbe wie
+[http://testwebseite.de/](http://testwebseite.de/)
+
+<!-- Automatische Links für E-Mail-Addressen -->
+
+<foo@bar.com>
+
+<!-- Maskieren -->
+
+Ich würde *diesen Teil gerne mit Sternen umschließen*, doch ohne dass er kursiv
+wird. Also mache ich folgendes: \*Ich umschließe diesen Text mit Sternen\*!
+
+<!-- Tabellen -->
+<!-- Tabellen gibt es bis jetzt nur in "Github Flavored Markdown".
+Zudem sind sie ziemlich mühselig, aber wenn du es wirklich wissen willst: -->
+
+| Spalte1 | Spalte2 | Spalte3 |
+| :----------- | :------: | ------------: |
+| linksbündig | mittig | rechtsbündig |
+| blah | blah | blah |
+
+<!-- oder das selbe in grün: -->
+
+Spalte1 | Spalte2 | Spalte3
+:-- | :-: | --:
+Ganz schön hässlich | vielleicht doch lieber | wieder aufhören
+
+<!-- Das war's! -->
+
+```
+
+Mehr Informationen gibt es in [John Gruber's offiziellem Blog-Post](http://daringfireball.net/projects/markdown/syntax)
+und bei Adam Pritchards [grandiosem Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
+Infos zu Github Flavored Markdown [gibt es hier](https://help.github.com/articles/github-flavored-markdown). \ No newline at end of file
diff --git a/elixir.html.markdown b/elixir.html.markdown
index 946c0a1b..c0abc815 100644
--- a/elixir.html.markdown
+++ b/elixir.html.markdown
@@ -360,7 +360,7 @@ spawn(f) #=> #PID<0.40.0>
# `spawn` returns a pid (process identifier), you can use this pid to send
# messages to the process. To do message passing we use the `send` operator.
# For all of this to be useful we need to be able to receive messages. This is
-# achived with the `receive` mechanism:
+# achieved with the `receive` mechanism:
defmodule Geometry do
def area_loop do
receive do
diff --git a/erlang.html.markdown b/erlang.html.markdown
index 64b62f05..04086aeb 100644
--- a/erlang.html.markdown
+++ b/erlang.html.markdown
@@ -260,22 +260,22 @@ spawn(F). % <0.44.0>
% For all of this to be useful we need to be able to receive messages. This is
% achieved with the `receive` mechanism:
--module(caculateGeometry).
+-module(calculateGeometry).
-compile(export_all).
-caculateAera() ->
+calculateArea() ->
receive
{rectangle, W, H} ->
W * H;
{circle, R} ->
3.14 * R * R;
_ ->
- io:format("We can only caculate area of rectangles or circles.")
+ io:format("We can only calculate area of rectangles or circles.")
end.
-% Compile the module and create a process that evaluates `caculateAera` in the shell
-c(caculateGeometry).
-CaculateAera = spawn(caculateGeometry, caculateAera, []).
-CaculateAera ! {circle, 2}. % 12.56000000000000049738
+% Compile the module and create a process that evaluates `calculateArea` in the shell
+c(calculateGeometry).
+CalculateArea = spawn(calculateGeometry, calculateArea, []).
+CalculateArea ! {circle, 2}. % 12.56000000000000049738
% The shell is also a process, you can use `self` to get the current pid
self(). % <0.41.0>
diff --git a/es-es/bash-es.html.markdown b/es-es/bash-es.html.markdown
index 489fd39e..fb89b2a0 100644
--- a/es-es/bash-es.html.markdown
+++ b/es-es/bash-es.html.markdown
@@ -11,6 +11,7 @@ contributors:
translators:
- ["Daniel Zendejas", "https://github.com/danielzendejas"]
filename: LearnBash-es.sh
+lang: es-es
---
Tutorial de Shell en español.
diff --git a/fr-fr/css-fr.html.markdown b/fr-fr/css-fr.html.markdown
new file mode 100644
index 00000000..bdab9715
--- /dev/null
+++ b/fr-fr/css-fr.html.markdown
@@ -0,0 +1,221 @@
+---
+language: css
+contributors:
+ - ["Mohammad Valipour", "https://github.com/mvalipour"]
+ - ["Marco Scannadinari", "https://github.com/marcoms"]
+translators:
+ - ["@prrrnd", "https://github.com/prrrnd"]
+lang: fr-fr
+---
+
+Au début du web, il n'y avait pas d'élements visuels, simplement du texte pure. Mais avec le dévelopement des navigateurs,
+des pages avec du contenu visuel sont arrivées.
+CSS est le langage standard qui existe et permet de garder une séparation entre
+le contenu (HTML) et le style d'une page web.
+
+En résumé, CSS fournit une syntaxe qui vous permet de cibler des élements présents
+sur une page HTML afin de leur donner des propriétés visuelles différentes.
+
+Comme tous les autres langages, CSS a plusieurs versions. Ici, nous allons parlons de CSS2.0
+qui n'est pas le plus récent, mais qui reste le plus utilisé et le plus compatible avec les différents navigateur.
+
+**NOTE :** Vous pouvez tester les effets visuels que vous ajoutez au fur et à mesure du tutoriel sur des sites comme [dabblet](http://dabblet.com/) afin de voir les résultats, comprendre, et vous familiariser avec le langage.
+Cet article porte principalement sur la syntaxe et quelques astuces.
+
+
+```css
+/* Les commentaires sont entourés par slash-étoile, comme cette ligne! */
+
+/* ####################
+ ## SÉLECTEURS
+ ####################*/
+
+/* Généralement, la première déclaration en CSS est très simple */
+selecteur { propriete: valeur; /* autres proprietés...*/ }
+
+/* Le sélécteur sert à cibler un élément du HTML
+
+Vous pouvez cibler tous les éléments d'une page! */
+* { color:red; }
+
+/*
+Voici un élément dans notre HTML :
+
+<div class='une-classe classe2' id='unId' attr='valeur' />
+*/
+
+/* Vous pouvez le cibler par une classe */
+.une-classe { }
+
+/* ou par deux */
+.une-classe.classe2 { }
+
+/* ou par son type */
+div { }
+
+/* ou son id */
+#unId { }
+
+/* ou par le fait qu'il a un attribut */
+[attr] { font-size:smaller; }
+
+/* ou que l'attribut a une valeur spécifique */
+[attr='valeur'] { font-size:smaller; }
+
+/* commence avec une valeur */
+[attr^='val'] { font-size:smaller; }
+
+/* termine avec une valeur */
+[attr$='eur'] { font-size:smaller; }
+
+/* contient une valeur */
+[attr~='leu'] { font-size:smaller; }
+
+
+/* Ce qu'il faut bien comprendre, c'est que vous pouvez combiner ceci -- Il ne doit pas y avoir
+d'espaces entre. */
+div.une-classe[attr$='eu'] { }
+
+/* Vous pouvez aussi cibler un élément par son parent. */
+
+/* Un élément qui est en enfant direct */
+div.un-parent > .enfant {}
+
+/* Cela cible aussi les .enfants plus profonds dans la structure HTML */
+div.un-parent .enfants {}
+
+/* Attention : le même sélecteur sans espace a un autre sens. */
+div.un-parent.classe {}
+
+/* Vous pouvez cibler un élément basé sur un enfant de même parent */
+.je-suis-avant + .cet-element { }
+
+/* ou n'importe quel enfant de même parent avec celui ci */
+.je-suis-tout-avant ~ .cet-element {}
+
+/* Il y a des pseudo-classes qui permettent de cibler un élément
+basé sur le comportement, en plus de la structure de la page */
+
+/* élément avec le curseur au-dessus */
+:hover {}
+
+/* lien visité */
+:visited {}
+
+/* lien non visité */
+:link {}
+
+/* élément avec le focus */
+:focus {}
+
+
+/* ####################
+ ## PROPRIÉTÉS
+ ####################*/
+
+selecteur {
+
+ /* Units */
+ width: 50%; /* pourcentage */
+ font-size: 2em; /* taille de la police multipliée par X */
+ width: 200px; /* pixels */
+ font-size: 20pt; /* points */
+ width: 5cm; /* centimetres */
+ width: 50mm; /* millimetres */
+ width: 5in; /* pouces */
+
+ /* Couleurs */
+ background-color: #F6E; /* court hex */
+ background-color: #F262E2; /* long hex */
+ background-color: tomato; /* couleur nommée */
+ background-color: rgb(255, 255, 255); /* rouge, vert, bleu */
+ background-color: rgb(10%, 20%, 50%); /* rouge, vert, bleu en pourcent */
+ background-color: rgba(255, 0, 0, 0.3); /* rouge, vert, bleu avec transparence */
+
+ /* Images */
+ background-image: url(/chemin-vers-image/image.jpg);
+
+ /* Polices */
+ font-family: Arial;
+ font-family: "Courier New"; /* Si espace, entre guillemets */
+ font-family: "Courier New", Trebuchet, Arial; /* Si la première n'est pas trouvée, la deuxième est utilisée, etc... */
+}
+
+```
+
+## Utilisation
+
+Le CSS s'écrit dans des fichiers `.css`.
+
+```xml
+<!-- Vous devez inclure le CSS dans la balise <head> : -->
+<link rel='stylesheet' type='text/css' href='chemin/style.css' />
+
+<!-- Vous pouvez inclure du CSS dans le HTML directement, mais ce n'est vraiment pas recommandé. -->
+<style>
+ selecteur { propriete:valeur; }
+</style>
+
+<!-- ou directement sur l'élément HTML.
+PS : à ne pas faire. -->
+<div style='propriete:valeur;'>
+</div>
+
+```
+
+## Priorités
+
+Comme on vient de le voir, un élément peut être ciblé par plus qu'un seul sélecteur
+et une même propriété peut être définie plusieurs fois.
+Dans ces cas, une des propriétés devient prioritaire.
+
+Voici du code CSS :
+
+```css
+/*A*/
+p.classe1[attr='valeur']
+
+/*B*/
+p.classe1 {}
+
+/*C*/
+p.classe2 {}
+
+/*D*/
+p {}
+
+/*E*/
+p { propriete: valeur !important; }
+
+```
+
+et le code HTML:
+
+```xml
+<p style='/*F*/ propriete:valeur;' class='classe1 classe2' attr='valeur'>
+</p>
+```
+
+Les priorités de style sont :
+Attention, les priorités s'appliquent aux **propriétés**, pas aux blocs entiers.
+
+* `E` a la priorité grâce à `!important`.
+* `F` vient ensuite, car le code se trouve directement dans le HTML.
+* `A` vient ensuite, car il est le plus spécifique.
+ plus spécifique veut dire, celui qui cible le plus l'élément
+* `C` vient ensuite. Il est aussi spécifique que `B`, mais est écrit après.
+* Puis `B`
+* Et enfin `D`.
+
+## Compatibilité
+
+La plupart des fonctionnalités de CSS2 (et de plus en plus CSS3) sont compatibles
+avec tous les navigateurs. Mais il est important de vérifier la compatibilité.
+
+[QuirksMode CSS](http://www.quirksmode.org/css/) est une très bonne source pour cela.
+
+## En savoir plus (en anglais)
+
+* [Understanding Style Precedence in CSS: Specificity, Inheritance, and the Cascade](http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/)
+* [QuirksMode CSS](http://www.quirksmode.org/css/)
+* [Z-Index - The stacking context](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context)
diff --git a/go.html.markdown b/go.html.markdown
index b4c6afff..17f10bd9 100644
--- a/go.html.markdown
+++ b/go.html.markdown
@@ -72,7 +72,7 @@ func learnMultiple(x, y int) (sum, prod int) {
// Some built-in types and literals.
func learnTypes() {
// Short declaration usually gives you what you want.
- s := "Learn Go!" // string type.
+ str := "Learn Go!" // string type.
s2 := `A "raw" string literal
can include line breaks.` // Same string type.
@@ -126,7 +126,7 @@ can include line breaks.` // Same string type.
// Unused variables are an error in Go.
// The underbar lets you "use" a variable but discard its value.
- _, _, _, _, _, _, _, _, _ = s2, g, f, u, pi, n, a3, s4, bs
+ _, _, _, _, _, _, _, _, _, _ = str, s2, g, f, u, pi, n, a3, s4, bs
// Output of course counts as using a variable.
fmt.Println(s, c, a4, s3, d2, m)
diff --git a/json.html.markdown b/json.html.markdown
index 9041eaa2..f5287138 100644
--- a/json.html.markdown
+++ b/json.html.markdown
@@ -17,7 +17,7 @@ going to be 100% valid JSON. Luckily, it kind of speaks for itself.
{
"key": "value",
- "keys": "must always be enclosed in quotes (either double or single)",
+ "keys": "must always be enclosed in double quotes",
"numbers": 0,
"strings": "Hellø, wørld. All unicode is allowed, along with \"escaping\".",
"has bools?": true,
diff --git a/julia.html.markdown b/julia.html.markdown
index e9d3a162..feb38463 100644
--- a/julia.html.markdown
+++ b/julia.html.markdown
@@ -12,7 +12,7 @@ This is based on the current development version of Julia, as of October 18th, 2
```ruby
-# Single line comments start with a number symbol.
+# Single line comments start with a hash (pound) symbol.
#= Multiline comments can be written
by putting '#=' before the text and '=#'
after the text. They can also be nested.
@@ -125,8 +125,9 @@ SomeOtherVar123! = 6 # => 6
# A note on naming conventions in Julia:
#
-# * Names of variables are in lower case, with word separation indicated by
-# underscores ('\_').
+# * Word separation can be indicated by underscores ('_'), but use of
+# underscores is discouraged unless the name would be hard to read
+# otherwise.
#
# * Names of Types begin with a capital letter and word separation is shown
# with CamelCase instead of underscores.
diff --git a/learntmux.html.markdown b/learntmux.html.markdown
deleted file mode 100644
index eaf3fd25..00000000
--- a/learntmux.html.markdown
+++ /dev/null
@@ -1,71 +0,0 @@
----
-category: tool
-tool: tmux
-contributors:
- - ["kaernyk", "http://github.com/kaernyk"]
-filename: LearnTmux.txt
----
-
-
- tmux is a terminal multiplexer: it enables a number of terminals to be
-created, accessed, and controlled from a single screen. tmux may be detached
-from a screen and continue running in the background, then later reattached.
-
- Once you feel comfortable manipulating tmux to suit your needs, I strongly
-suggest you read the man pages.
-
-
-
-```
-# Session Management
-
- tmux new Create new session
- -s "Session" Create named session
- -n "Window" Create named Window
- -c "/dir" Start in target directory
-
- C^b $ Rename current session
- C^b d Detach current session
- C^b D Select session to detach
-
- tmux attach Attach last/available session
- -t "#" Attach target session
- -d Detach the session from other instances
-
- tmux ls List open sessions
- C^b s Select new session for attached client interactively
-
- kill-session Kill current session
- -t "#" Kill target session
- -a Kill all sessions
- -a -t "#" Kill all sessions but the target
-
-
-# Window Management
-
- C^b c Create another window
- C^b " Split Horizontally
- C^b % Split Vertically
- C^b M-(1-5) 1) Tile vertically
- 2) Tile horizontally
- 3) Tile Vertically /w large horizontal
- 4) Tile horizontally /w large vertical
- 5) Tile all windows evenly
-
- C^b q Briefly display pane indexes
- C^# Choose current window by #
- C^b w Choose current window interactively
- C^b n Change to next window
- C^b p Change to previous window
- C^b Up, Right Change to pane in selected direction
- Down, left
- C^b { Swap current/previous window
- C^b } Swap current/next window
-
- C^b C-Up, Right Resize in steps of one cell
- Down, left
- C^b M-Up, Right resize in steps of five cells
- Down, left
-
- exit or C^b x Kill the current window
-```
diff --git a/markdown.html.markdown b/markdown.html.markdown
index 805255b8..3d4d0af6 100644
--- a/markdown.html.markdown
+++ b/markdown.html.markdown
@@ -39,7 +39,7 @@ This is an h2
-------------
<!-- Simple text styles -->
-<!-- Text can be easily styled as italic, bold, or strikethrough using markdown -->
+<!-- Text can be easily styled as italic or bold using markdown -->
*This text is in italics.*
_And so is this text._
@@ -52,7 +52,7 @@ __And so is this text.__
*__And this!__*
<!-- In Github Flavored Markdown, which is used to render markdown files on
-Github, we also have: -->
+Github, we also have strikethrough: -->
~~This text is rendered with strikethrough.~~
@@ -201,11 +201,11 @@ can be anything so long as they are unique. -->
<!-- Images -->
<!-- Images are done the same way as links but with an exclamation point in front! -->
-![This is hover-text (alt text) for my image](http://imgur.com/myimage.jpg "An optional title")
+![This is the alt-attribute for my image](http://imgur.com/myimage.jpg "An optional title")
<!-- And reference style works as expected -->
-![This is the hover-text.][myimage]
+![This is the alt-attribute.][myimage]
[myimage]: relative/urls/cool/image.jpg "if you need a title, it's here"
diff --git a/nim.html.markdown b/nim.html.markdown
new file mode 100644
index 00000000..c74fece7
--- /dev/null
+++ b/nim.html.markdown
@@ -0,0 +1,265 @@
+---
+language: Nim
+filename: learnNim.nim
+contributors:
+ - ["Jason J. Ayala P.", "http://JasonAyala.com"]
+---
+
+Nim (formally Nimrod) is a statically typed, imperative programming language
+that gives the programmer power without compromises on runtime efficiency.
+
+Nim is efficient, expressive, and elegant.
+
+```ruby
+var # Declare (and assign) variables,
+ letter: char = 'n' # with or without type annotations
+ lang = "N" & "im"
+ nLength : int = len(lang)
+ boat: float
+ truth: bool = false
+
+let # Use let to declare and bind variables *once*.
+ legs = 400 # legs is immutable.
+ arms = 2_000 # _ are ignored and are useful for long numbers.
+ aboutPi = 3.15
+
+const # Constants are computed at compile time. This provides
+ debug = true # performance and is useful in compile time expressions.
+ compileBadCode = false
+
+when compileBadCode: # `when` is a compile time `if`
+ legs = legs + 1 # This error will never be compiled.
+ const input = readline(stdin) # Const values must be known at compile time.
+
+discard 1 > 2 # Note: The compiler will complain if the result of an expression
+ # is unused. `discard` bypasses this.
+
+discard """
+This can work as a multiline comment.
+Or for unparsable, broken code
+"""
+
+#
+# Data Structures
+#
+
+# Tuples
+
+var
+ child: tuple[name: string, age: int] # Tuples have *both* field names
+ today: tuple[sun: string, temp: float] # *and* order.
+
+child = (name: "Rudiger", age: 2) # Assign all at once with literal ()
+today.sun = "Overcast" # or individual fields.
+today.temp = 70.1
+
+# Sequences
+
+var
+ drinks: seq[string]
+
+drinks = @["Water", "Juice", "Chocolate"] # @[V1,..,Vn] is the sequence literal
+
+#
+# Defining Types
+#
+
+# Defining your own types puts the compiler to work for you. It's what makes
+# static typing powerful and useful.
+
+type
+ Name = string # A type alias gives you a new type that is interchangable
+ Age = int # with the old type but is more descriptive.
+ Person = tuple[name: Name, age: Age] # Define data structures too.
+ AnotherSyntax = tuple
+ fieldOne: string
+ secondField: int
+
+var
+ john: Person = (name: "John B.", age: 17)
+ newage: int = 18 # It would be better to use Age than int
+
+john.age = newage # But still works because int and Age are synonyms
+
+type
+ Cash = distinct int # `distinct` makes a new type incompatible with its
+ Desc = distinct string # base type.
+
+var
+ money: Cash = 100.Cash # `.Cash` converts the int to our type
+ description: Desc = "Interesting".Desc
+
+when compileBadCode:
+ john.age = money # Error! age is of type int and money is Cash
+ john.name = description # Compiler says: "No way!"
+
+#
+# More Types and Data Structures
+#
+
+# Enumerations allow a type to have one of a limited number of values
+
+type
+ Color = enum cRed, cBlue, cGreen
+ Direction = enum # Alternative formating
+ dNorth
+ dWest
+ dEast
+ dSouth
+var
+ orient = dNorth # `orient` is of type Direction, with the value `dNorth`
+ pixel = cGreen # `pixel` is of type Color, with the value `cGreen`
+
+discard dNorth > dEast # Enums are usually an "ordinal" type
+
+# Subranges specify a limited valid range
+
+type
+ DieFaces = range[1..20] # Only an int from 1 to 20 is a valid value
+var
+ my_roll: DieFaces = 13
+
+when compileBadCode:
+ my_roll = 23 # Error!
+
+# Arrays
+
+type
+ RollCounter = array[DieFaces, int] # Array's are fixed length and
+ DirNames = array[Direction, string] # indexed by any ordinal type.
+ Truths = array[42..44, bool]
+var
+ counter: RollCounter
+ directions: DirNames
+ possible: Truths
+
+possible = [false, false, false] # Literal arrays are created with [V1,..,Vn]
+possible[42] = true
+
+directions[dNorth] = "Ahh. The Great White North!"
+directions[dWest] = "No, don't go there."
+
+my_roll = 13
+counter[my_roll] += 1
+counter[my_roll] += 1
+
+var anotherArray = ["Default index", "starts at", "0"]
+
+# More data structures are available, including tables, sets, lists, queues,
+# and crit bit trees.
+# http://nimrod-lang.org/lib.html#collections-and-algorithms
+
+#
+# IO and Control Flow
+#
+
+# `case`, `readLine()`
+
+echo "Read any good books lately?"
+case readLine(stdin)
+of "no", "No":
+ echo "Go to your local library."
+of "yes", "Yes":
+ echo "Carry on, then."
+else:
+ echo "That's great; I assume."
+
+# `while`, `if`, `continue`, `break`
+
+import strutils as str # http://nimrod-lang.org/strutils.html
+echo "I'm thinking of a number between 41 and 43. Guess which!"
+let number: int = 42
+var
+ raw_guess: string
+ guess: int
+while guess != number:
+ raw_guess = readLine(stdin)
+ if raw_guess == "": continue # Skip this iteration
+ guess = str.parseInt(raw_guess)
+ if guess == 1001:
+ echo("AAAAAAGGG!")
+ break
+ elif guess > number:
+ echo("Nope. Too high.")
+ elif guess < number:
+ echo(guess, " is too low")
+ else:
+ echo("Yeeeeeehaw!")
+
+#
+# Iteration
+#
+
+for i, elem in ["Yes", "No", "Maybe so"]: # Or just `for elem in`
+ echo(elem, " is at index: ", i)
+
+for k, v in items(@[(person: "You", power: 100), (person: "Me", power: 9000)]):
+ echo v
+
+let myString = """
+an <example>
+`string` to
+play with
+""" # Multiline raw string
+
+for line in splitLines(myString):
+ echo(line)
+
+for i, c in myString: # Index and letter. Or `for j in` for just letter
+ if i mod 2 == 0: continue # Compact `if` form
+ elif c == 'X': break
+ else: echo(c)
+
+#
+# Procedures
+#
+
+type Answer = enum aYes, aNo
+
+proc ask(question: string): Answer =
+ echo(question, " (y/n)")
+ while true:
+ case readLine(stdin)
+ of "y", "Y", "yes", "Yes":
+ return Answer.aYes # Enums can be qualified
+ of "n", "N", "no", "No":
+ return Answer.aNo
+ else: echo("Please be clear: yes or no")
+
+proc addSugar(amount: int = 2) = # Default amount is 2, returns nothing
+ assert(amount > 0 or amount < 9000, "Crazy Sugar")
+ for a in 1..amount:
+ echo(a, " sugar...")
+
+case ask("Would you like sugar in your tea?")
+of aYes:
+ addSugar(3)
+of aNo:
+ echo "Oh do take a little!"
+ addSugar()
+# No need for an `else` here. Only `yes` and `no` are possible.
+
+#
+# FFI
+#
+
+# Because Nim compiles to C, FFI is easy:
+
+proc strcmp(a, b: cstring): cint {.importc: "strcmp", nodecl.}
+
+let cmp = strcmp("C?", "Easy!")
+```
+
+Additionally, Nim separates itself from its peers with metaprogramming,
+performance, and compile-time features.
+
+## Further Reading
+
+* [Home Page](http://nimrod-lang.org)
+* [Download](http://nimrod-lang.org/download.html)
+* [Community](http://nimrod-lang.org/community.html)
+* [FAQ](http://nimrod-lang.org/question.html)
+* [Documentation](http://nimrod-lang.org/documentation.html)
+* [Manual](http://nimrod-lang.org/manual.html)
+* [Standard Libray](http://nimrod-lang.org/lib.html)
+* [Rosetta Code](http://rosettacode.org/wiki/Category:Nimrod)
diff --git a/nl-nl/coffeescript-nl.html.markdown b/nl-nl/coffeescript-nl.html.markdown
new file mode 100644
index 00000000..70dcd463
--- /dev/null
+++ b/nl-nl/coffeescript-nl.html.markdown
@@ -0,0 +1,109 @@
+---
+language: coffeescript
+contributors:
+ - ["Tenor Biel", "http://github.com/L8D"]
+ - ["Xavier Yao", "http://github.com/xavieryao"]
+translators:
+ - ["Jelle Besseling", "https://github.com/Jell-E"]
+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.
+
+Op [de CoffeeScript website](http://coffeescript.org/), staat een
+vollediger 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.
+
+###
+Blokken commentaar maak je zo, ze vertalen naar JavaScripts */ en /*
+in de uitvoer van de CoffeeScript compiler.
+
+Het is belangrijk dat je ongeveer snapt hoe JavaScript
+werkt voordat je verder gaat.
+###
+
+# Toewijzing:
+getal = 42 #=> var getal = 42;
+tegengestelde = true #=> var tegengestelde = true;
+
+# Voorwaarden:
+getal = -42 if tegengestelde #=> if(tegengestelde) { getal = -42; }
+
+# Functies:
+kwadraat = (x) -> x * x #=> var kwadraat = function(x) { return x * x; }
+
+vul = (houder, vloeistof = "koffie") ->
+ "Nu de #{houder} met #{koffie} aan het vullen..."
+#=>var vul;
+#
+#vul = function(houder, vloeistof) {
+# if (vloeistof == null) {
+# vloeistof = "coffee";
+# }
+# return "Nu de " + houder + " met " + vloeistof + " aan het vullen...";
+#};
+
+# Reeksen:
+lijst = [1..5] #=> var lijst = [1, 2, 3, 4, 5];
+
+# Objecten:
+wiskunde =
+ wortel: Math.sqrt
+ kwadraat: kwadraat
+ derdemacht: (x) -> x * kwadraat x
+#=> var wiskunde = {
+# "wortel": Math.sqrt,
+# "kwadraat": kwadraat,
+# "derdemacht": function(x) { return x * kwadraat(x); }
+#}
+
+# "Splats":
+wedstrijd = (winnaar, lopers...) ->
+ print winnaar, lopers
+#=>wedstrijd = function() {
+# var lopers, winnaar;
+# winnaar = arguments[0], lopers = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+# return print(winnaar, lopers);
+#};
+
+# Bestaan:
+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 = (function() {
+# var _i, _len, _results;
+# _results = [];
+# for (_i = 0, _len = lijst.length; _i < _len; _i++) {
+# num = list[_i];
+# _results.push(wiskunde.derdemacht(num));
+# }
+# return _results;
+# })();
+
+etenswaren = ['broccoli', 'spinazie', 'chocolade']
+eet eten for eten in etenswaren when eten isnt 'chocolade'
+#=>etenswaren = ['broccoli', 'spinazie', 'chocolade'];
+#
+#for (_k = 0, _len2 = etenswaren.length; _k < _len2; _k++) {
+# eten = etenswaren[_k];
+# if (eten !== 'chocolade') {
+# eet(eten);
+# }
+#}
+```
+
+## Handige links (in het Engels):
+
+- [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/)
+- [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read)
diff --git a/ocaml.html.markdown b/ocaml.html.markdown
new file mode 100644
index 00000000..b9505f13
--- /dev/null
+++ b/ocaml.html.markdown
@@ -0,0 +1,372 @@
+---
+language: OCaml
+contributors:
+ - ["Daniil Baturin", "http://baturin.org/"]
+---
+
+OCaml is a strictly evaluated functional language with some imperative
+features.
+
+Along with StandardML and its dialects it belongs to ML language family.
+F# is also heavily influenced by OCaml.
+
+Just like StandardML, OCaml features both an interpreter, that can be
+used interactively, and a compiler.
+The interpreter binary is normally called "ocaml" and the compiler is "ocamlopt".
+There is also a bytecode compiler, "ocamlc", but there are few reasons to use it.
+
+It is strongly and statically typed, but instead of using manually written
+type annotations, it infers types of expressions using Hindley-Milner algorithm.
+It makes type annotations unnecessary in most cases, but can be a major
+source of confusion for beginners.
+
+When you are in the top level loop, OCaml will print the inferred type
+after you enter an expression.
+
+```
+# let inc x = x + 1 ;;
+val inc : int -> int = <fun>
+# let a = 99 ;;
+val a : int = 99
+```
+
+For a source file you can use "ocamlc -i /path/to/file.ml" command
+to print all names and type signatures.
+
+```
+$ cat sigtest.ml
+let inc x = x + 1
+let add x y = x + y
+
+let a = 1
+
+$ ocamlc -i ./sigtest.ml
+val inc : int -> int
+val add : int -> int -> int
+val a : int
+```
+
+Note that type signatures of functions of multiple arguments are
+written in curried form. A function that takes multiple arguments can be
+represented as a composition of functions that take only one argument.
+The "f(x,y) = x + y" function from the example above applied to
+arguments 2 and 3 is equivalent to the "f0(y) = 2 + y" function applied to 3.
+Hence the "int -> int -> int" signature.
+
+
+```ocaml
+(*** Comments ***)
+
+(* Comments are enclosed in (* and *). It's fine to nest comments. *)
+
+(* There are no single-line comments. *)
+
+
+(*** Variables and functions ***)
+
+(* Expressions can be separated by a double semicolon symbol, ";;".
+ In many cases it's redundant, but in this tutorial we use it after
+ every expression for easy pasting into the interpreter shell.
+ Unnecessary use of expression separators in source code files
+ is often considered to be a bad style. *)
+
+(* Variable and function declarations use "let" keyword. *)
+let x = 10 ;;
+
+(* OCaml allows single quote characters in identifiers.
+ Single quote doesn't have a special meaning in this case, it's often used
+ in cases when in other languages one would use names like "foo_tmp". *)
+let foo = 1 ;;
+let foo' = foo * 2 ;;
+
+(* Since OCaml compiler infers types automatically, you normally don't need to
+ specify argument types explicitly. However, you can do it if
+ you want or need to. *)
+let inc_int (x: int) : int = x + 1 ;;
+
+(* One of the cases when explicit type annotations may be needed is
+ resolving ambiguity between two record types that have fields with
+ the same name. The alternative is to encapsulate those types in
+ modules, but both topics are a bit out of scope of this
+ tutorial. *)
+
+(* 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)
+;;
+
+(* Function application usually doesn't need parentheses around arguments *)
+let fact_5 = factorial 5 ;;
+
+(* ...unless the argument is an expression. *)
+let fact_4 = factorial (5-1) ;;
+let sqr2 = sqr (-2) ;;
+
+(* Every function must have at least one argument.
+ Since some funcions naturally don't take any arguments, there's
+ "unit" type for it that has the only one value written as "()" *)
+let print_hello () = print_endline "hello world" ;;
+
+(* Note that you must specify "()" as argument when calling it. *)
+print_hello () ;;
+
+(* Calling a function with insufficient number of arguments
+ does not cause an error, it produces a new function. *)
+let make_inc x y = x + y ;; (* make_inc is int -> int -> int *)
+let inc_2 = make_inc 2 ;; (* inc_2 is int -> int *)
+inc_2 3 ;; (* Evaluates to 5 *)
+
+(* You can use multiple expressions in function body.
+ The last expression becomes the return value. All other
+ expressions must be of the "unit" type.
+ This is useful when writing in imperative style, the simplest
+ form of it is inserting a debug print. *)
+let print_and_return x =
+ print_endline (string_of_int x);
+ x
+;;
+
+(* Since OCaml is a functional language, it lacks "procedures".
+ Every function must return something. So functions that
+ do not really return anything and are called solely for their
+ side effects, like print_endline, return value of "unit" type. *)
+
+
+(* Definitions can be chained with "let ... in" construct.
+ This is roughly the same to assigning values to multiple
+ variables before using them in expressions in imperative
+ languages. *)
+let x = 10 in
+let y = 20 in
+x + y ;;
+
+(* Alternatively you can use "let ... and ... in" construct.
+ This is especially useful for mutually recursive functions,
+ with ordinary "let .. in" the compiler will complain about
+ unbound values.
+ It's hard to come up with a meaningful but self-contained
+ example of mutually recursive functions, but that syntax
+ works for non-recursive definitions too. *)
+let a = 3 and b = 4 in a * b ;;
+
+(* Anonymous functions use the following syntax: *)
+let my_lambda = fun x -> x * x ;;
+
+(*** Operators ***)
+
+(* There is little distintion between operators and functions.
+ Every operator can be called as a function. *)
+
+(+) 3 4 (* Same as 3 + 4 *)
+
+(* There's a number of built-in operators. One unusual feature is
+ that OCaml doesn't just refrain from any implicit conversions
+ between integers and floats, it also uses different operators
+ for floats. *)
+12 + 3 ;; (* Integer addition. *)
+12.0 +. 3.0 ;; (* Floating point addition. *)
+
+12 / 3 ;; (* Integer division. *)
+12.0 /. 3.0 ;; (* Floating point division. *)
+5 mod 2 ;; (* Remainder. *)
+
+(* Unary minus is a notable exception, it's polymorphic.
+ However, it also has "pure" integer and float forms. *)
+- 3 ;; (* Polymorphic, integer *)
+- 4.5 ;; (* Polymorphic, float *)
+~- 3 (* Integer only *)
+~- 3.4 (* Type error *)
+~-. 3.4 (* Float only *)
+
+(* You can define your own operators or redefine existing ones.
+ Unlike SML or Haskell, only selected symbols can be used
+ for operator names and first symbol defines associativity
+ and precedence rules. *)
+let (+) a b = a - b ;; (* Surprise maintenance programmers. *)
+
+(* More useful: a reciprocal operator for floats.
+ Unary operators must start with "~". *)
+let (~/) x = 1.0 /. x ;;
+~/4.0 (* = 0.25 *)
+
+
+(*** Built-in datastructures ***)
+
+(* Lists are enclosed in square brackets, items are separated by
+ semicolons. *)
+let my_list = [1; 2; 3] ;;
+
+(* Tuples are (optionally) enclosed in parentheses, items are separated
+ by commas. *)
+let first_tuple = 3, 4 ;; (* Has type "int * int". *)
+let second_tuple = (4, 5) ;;
+
+(* Corollary: if you try to separate list items by commas, you get a list
+ with a tuple inside, probably not what you want. *)
+let bad_list = [1, 2] ;; (* Becomes [(1, 2)] *)
+
+(* You can access individual list items with the List.nth function. *)
+List.nth my_list 1 ;;
+
+(* There are higher-order functions for lists such as map and filter. *)
+List.map (fun x -> x * 2) [1; 2; 3] ;;
+List.filter (fun x -> if x mod 2 = 0 then true else false) [1; 2; 3; 4] ;;
+
+(* You can add an item to the beginning of a list with the "::" constructor
+ often referred to as "cons". *)
+1 :: [2; 3] ;; (* Gives [1; 2; 3] *)
+
+(* Arrays are enclosed in [| |] *)
+let my_array = [| 1; 2; 3 |] ;;
+
+(* You can access array items like this: *)
+my_array.(0) ;;
+
+
+(*** Strings and characters ***)
+
+(* Use double quotes for string literals. *)
+let my_str = "Hello world" ;;
+
+(* Use single quotes for character literals. *)
+let my_char = 'a' ;;
+
+(* Single and double quotes are not interchangeable. *)
+let bad_str = 'syntax error' ;; (* Syntax error. *)
+
+(* This will give you a single character string, not a character. *)
+let single_char_str = "w" ;;
+
+(* Strings can be concatenated with the "^" operator. *)
+let some_str = "hello" ^ "world" ;;
+
+(* Strings are not arrays of characters.
+ You can't mix characters and strings in expressions.
+ You can convert a character to a string with "String.make 1 my_char".
+ There are more convenient functions for this purpose in additional
+ libraries such as Core.Std that may not be installed and/or loaded
+ by default. *)
+let ocaml = (String.make 1 'O') ^ "Caml" ;;
+
+(* There is a printf function. *)
+Printf.printf "%d %s" 99 "bottles of beer" ;;
+
+(* Unformatted read and write functions are there too. *)
+print_string "hello world\n" ;;
+print_endline "hello world" ;;
+let line = read_line () ;;
+
+
+(*** User-defined data types ***)
+
+(* You can define types with the "type some_type =" construct. Like in this
+ useless type alias: *)
+type my_int = int ;;
+
+(* More interesting types include so called type constructors.
+ Constructors must start with a capital letter. *)
+type ml = OCaml | StandardML ;;
+let lang = OCaml ;; (* Has type "ml". *)
+
+(* Type constructors don't need to be empty. *)
+type my_number = PlusInfinity | MinusInfinity | Real of float ;;
+let r0 = Real (-3.4) ;; (* Has type "my_number". *)
+
+(* Can be used to implement polymorphic arithmetics. *)
+type number = Int of int | Float of float ;;
+
+(* Point on a plane, essentially a type-constrained tuple *)
+type point2d = Point of float * float ;;
+let my_point = Point (2.0, 3.0) ;;
+
+(* Types can be parameterized, like in this type for "list of lists
+ of anything". 'a can be substituted with any type. *)
+type 'a list_of_lists = 'a list list ;;
+type int_list_list = int list_of_lists ;;
+
+(* Types can also be recursive. Like in this type analogous to
+ built-in list of integers. *)
+type my_int_list = EmptyList | IntList of int * my_int_list ;;
+let l = Cons (1, EmptyList) ;;
+
+
+(*** Pattern matching ***)
+
+(* Pattern matching is somewhat similar to switch statement in imperative
+ languages, but offers a lot more expressive power.
+
+ Even though it may look complicated, it really boils down to matching
+ an argument against an exact value, a predicate, or a type constructor.
+ The type system is what makes it so powerful. *)
+
+(** Matching exact values. **)
+
+let is_zero x =
+ match x with
+ | 0 -> true
+ | _ -> false (* The "_" pattern means "anything else". *)
+;;
+
+(* Alternatively, you can use the "function" keyword. *)
+let is_one = function
+| 1 -> true
+| _ -> false
+;;
+
+(* Matching predicates, aka "guarded pattern matching". *)
+let abs x =
+ match x with
+ | x when x < 0 -> -x
+ | _ -> x
+;;
+
+abs 5 ;; (* 5 *)
+abs (-5) (* 5 again *)
+
+(** Matching type constructors **)
+
+type animal = Dog of string | Cat of string ;;
+
+let say x =
+ match x with
+ | Dog x -> x ^ " says woof"
+ | Cat x -> x ^ " says meow"
+;;
+
+say (Cat "Fluffy") ;; (* "Fluffy says meow". *)
+
+(** Traversing datastructures with pattern matching **)
+
+(* Recursive types can be traversed with pattern matching easily.
+ Let's see how we can traverse a datastructure of the built-in list type.
+ Even though the built-in cons ("::") looks like an infix operator,
+ it's actually a type constructor and can be matched like any other. *)
+let rec sum_list l =
+ match l with
+ | [] -> 0
+ | head :: tail -> head + (sum_list tail)
+;;
+
+sum_list [1; 2; 3] ;; (* Evaluates to 6 *)
+
+(* Built-in syntax for cons obscures the structure a bit, so we'll make
+ our own list for demonstration. *)
+
+type int_list = Nil | Cons of int * int_list ;;
+let rec sum_int_list l =
+ match l with
+ | Nil -> 0
+ | Cons (head, tail) -> head + (sum_int_list tail)
+;;
+
+let t = Cons (1, Cons (2, Cons (3, Nil))) ;;
+sum_int_list t ;;
+
+```
+
+## Further reading
+
+* Visit the official website to get the compiler and read the docs: <http://ocaml.org/>
+* Try interactive tutorials and a web-based interpreter by OCaml Pro: <http://try.ocamlpro.com/>
+* Read "OCaml for the skeptical" course: <http://www2.lib.uchicago.edu/keith/ocaml-class/home.html>
diff --git a/perl6.html.markdown b/perl6.html.markdown
index fe5b197c..7afcc930 100644
--- a/perl6.html.markdown
+++ b/perl6.html.markdown
@@ -46,18 +46,36 @@ my $inverse = !$bool; # You can invert a bool with the prefix `!` operator
my $forced-bool = so $str; # And you can use the prefix `so` operator
# which turns its operand into a Bool
-## * Arrays. They represent multiple values. Their name start with `@`.
+## * Lists. They represent multiple values. Their name start with `@`.
-my @array = 1, 2, 3;
my @array = 'a', 'b', 'c';
# equivalent to :
-my @array = <a b c>; # array of words, delimited by space.
+my @letters = <a b c>; # array of words, delimited by space.
# Similar to perl5's qw, or Ruby's %w.
+my @array = 1, 2, 3;
say @array[2]; # Array indices start at 0 -- This is the third element
say "Interpolate an array using [] : @array[]";
-#=> Interpolate an array using [] : a b c
+#=> Interpolate an array using [] : 1 2 3
+
+@array[0] = -1; # Assign a new value to an array index
+@array[0, 1] = 5, 6; # Assign multiple values
+
+my @keys = 0, 2;
+@array[@keys] = @letters; # Assign using an array
+say @array; #=> a 2 b
+
+# There are two more kinds of lists: Parcel and Arrays.
+# Parcels are immutable lists (you can't modify a list that's not assigned).
+# This is a parcel:
+(1, 2, 3); # Not assigned to anything. Changing an element would provoke an error
+# This is a list:
+my @a = (1, 2, 3); # Assigned to `@a`. Changing elements is okay!
+
+# Lists flatten (in list context). You'll see below how to apply item context
+# or use arrays to have real nested lists.
+
## * Hashes. Key-Value Pairs.
# Hashes are actually arrays of Pairs (`Key => Value`),
@@ -303,6 +321,37 @@ if long-computation() -> $result {
say "The result is $result";
}
+## Loops can also have a label, and be jumped to through these.
+OUTER: while 1 {
+ say "hey";
+ while 1 {
+ OUTER.last; # All the control keywords must be called on the label itself
+ }
+}
+
+# Now that you've seen how to traverse a list, you need to be aware of something:
+# List context (@) flattens. If you traverse nested lists, you'll actually be traversing a
+# shallow list (except if some sub-list were put in item context ($)).
+for 1, 2, (3, (4, ((5)))) {
+ say "Got $_.";
+} #=> Got 1. Got 2. Got 3. Got 4. Got 5.
+
+# ... However: (forcing item context with `$`)
+for 1, 2, $(3, 4) {
+ say "Got $_.";
+} #=> Got 1. Got 2. Got 3 4.
+
+# Note that the last one actually joined 3 and 4.
+# While `$(...)` will apply item to context to just about anything, you can also create
+# an array using `[]`:
+for [1, 2, 3, 4] {
+ say "Got $_.";
+} #=> Got 1 2 3 4.
+
+# The other difference between `$()` and `[]` is that `[]` always returns a mutable Array
+# whereas `$()` will return a Parcel when given a Parcel.
+
+
### Operators
## Since Perl languages are very much operator-based languages
@@ -359,9 +408,9 @@ $arg ~~ &bool-returning-function; # `True` if the function, passed `$arg`
# This also works as a shortcut for `0..^N`:
^10; # means 0..^10
-# This also allows us to demonstrate that Perl 6 has lazy arrays,
+# This also allows us to demonstrate that Perl 6 has lazy/infinite arrays,
# using the Whatever Star:
-my @array = 1..*; # 1 to Infinite !
+my @array = 1..*; # 1 to Infinite ! `1..Inf` is the same.
say @array[^10]; # you can pass arrays as subscripts and it'll return
# an array of results. This will print
# "1 2 3 4 5 6 7 8 9 10" (and not run out of memory !)
@@ -372,6 +421,13 @@ say @array[^10]; # you can pass arrays as subscripts and it'll return
# Perl 6 will be forced to try and evaluate the whole array (to print it),
# so you'll end with an infinite loop.
+# You can use that in most places you'd expect, even assigning to an array
+my @numbers = ^20;
+@numbers[5..*] = 3, 9 ... * > 90; # The right hand side could be infinite as well.
+ # (but not both, as this would be an infinite loop)
+say @numbers; #=> 3 9 15 21 27 [...] 81 87
+
+
## * And, Or
3 && 4; # 4, which is Truthy. Calls `.Bool` on `4` and gets `True`.
0 || False; # False. Calls `.Bool` on `0`
@@ -700,15 +756,37 @@ try {
open 'foo';
CATCH {
when X::AdHoc { say "unable to open file !" }
- # any other exception will be re-raised, since we don't have a `default`
+ # Any other exception will be re-raised, since we don't have a `default`
+ # Basically, if a `when` matches (or there's a `default`) marks the exception as
+ # "handled" so that it doesn't get re-thrown from the `CATCH`.
+ # You still can re-throw the exception (see below) by hand.
}
}
# You can throw an exception using `die`:
die X::AdHoc.new(payload => 'Error !');
-# TODO warn
-# TODO fail
-# TODO CONTROL
+
+# You can access the last exception with `$!` (usually used in a `CATCH` block)
+
+# There are also some subtelties to exceptions. Some Perl 6 subs return a `Failure`,
+# which is a kind of "unthrown exception". They're not thrown until you tried to look
+# at their content, unless you call `.Bool`/`.defined` on them - then they're handled.
+# (the `.handled` method is `rw`, so you can mark it as `False` back yourself)
+#
+# You can throw a `Failure` using `fail`. Note that if the pragma `use fatal` is on,
+# `fail` will throw an exception (like `die`).
+fail "foo"; # We're not trying to access the value, so no problem.
+try {
+ fail "foo";
+ CATCH {
+ default { say "It threw because we try to get the fail's value!" }
+ }
+}
+
+# There is also another kind of exception: Control exceptions.
+# Those are "good" exceptions, which happen when you change your program's flow,
+# using operators like `return`, `next` or `last`.
+# You can "catch" those with `CONTROL` (not 100% working in Rakudo yet).
### Packages
# Packages are a way to reuse code. Packages are like "namespaces", and any
@@ -1246,7 +1324,7 @@ so 'abc' ~~ / a b* c /; # `True`
so 'abbbbc' ~~ / a b* c /; # `True`
so 'aec' ~~ / a b* c /; # `False`. "b"(s) are optional, not replaceable.
-# - `**` - "Quantify It Yourself".
+# - `**` - (Unbound) Quantifier
# If you squint hard enough, you might understand
# why exponentation is used for quantity.
so 'abc' ~~ / a b ** 1 c /; # `True` (exactly one time)
@@ -1255,6 +1333,27 @@ so 'abbbc' ~~ / a b ** 1..3 c /; # `True`
so 'abbbbbbc' ~~ / a b ** 1..3 c /; # `False` (too much)
so 'abbbbbbc' ~~ / a b ** 3..* c /; # `True` (infinite ranges are okay)
+# - `<[]>` - Character classes
+# Character classes are the equivalent of PCRE's `[]` classes, but
+# they use a more perl6-ish syntax:
+say 'fooa' ~~ / f <[ o a ]>+ /; #=> 'fooa'
+# You can use ranges:
+say 'aeiou' ~~ / a <[ e..w ]> /; #=> 'aeiou'
+# Just like in normal regexes, if you want to use a special character, escape it
+# (the last one is escaping a space)
+say 'he-he !' ~~ / 'he-' <[ a..z \! \ ]> + /; #=> 'he-he !'
+# You'll get a warning if you put duplicate names
+# (which has the nice effect of catching the wrote quoting:)
+'he he' ~~ / <[ h e ' ' ]> /; # Warns "Repeated characters found in characters class"
+
+# You can also negate them ... (equivalent to `[^]` in PCRE)
+so 'foo' ~~ / <-[ f o ]> + /; # False
+
+# ... and compose them: :
+so 'foo' ~~ / <[ a..z ] - [ f o ]> + /; # False (any letter except f and o)
+so 'foo' ~~ / <-[ a..z ] + [ f o ]> + /; # True (no letter except f and o)
+so 'foo!' ~~ / <-[ a..z ] + [ f o ]> + /; # True (the + doesn't replace the left part)
+
## Grouping and capturing
# Group: you can group parts of your regexp with `[]`.
# These groups are *not* captured (like PCRE's `(?:)`).
@@ -1282,7 +1381,7 @@ say $0; # The same as above.
# You might be wondering why it's an array, and the answer is simple:
# Some capture (indexed using `$0`, `$/[0]` or a named one) will be an array
# IFF it can have more than one element
-# (so, with `*`, `+` and any `**`, but not with `?`).
+# (so, with `*`, `+` and `**` (whatever the operands), but not with `?`).
# Let's use examples to see that:
so 'fooABCbar' ~~ / foo ( A B C )? bar /; # `True`
say $/[0]; #=> 「ABC」
@@ -1296,15 +1395,53 @@ say $0.WHAT; #=> (Array)
# A specific quantifier will always capture an Array,
# may it be a range or a specific value (even 1).
-# If you're wondering how the captures are numbered, here's an explanation:
-TODO use graphs from s05
+# The captures are indexed per nesting. This means a group in a group will be nested
+# under its parent group: `$/[0][0]`, for this code:
+'hello-~-world' ~~ / ( 'hello' ( <[ \- \~ ]> + ) ) 'world' /;
+say $/[0].Str; #=> hello~
+say $/[0][0].Str; #=> ~
+# This stems from a very simple fact: `$/` does not contain strings, integers or arrays,
+# it only contains match objects. These contain the `.list`, `.hash` and `.Str` methods.
+# (but you can also just use `match<key>` for hash access and `match[idx]` for array access)
+say $/[0].list.perl; #=> (Match.new(...),).list
+ # We can see it's a list of Match objects. Those contain a bunch of infos:
+ # where the match started/ended, the "ast" (see actions later), etc.
+ # You'll see named capture below with grammars.
## Alternatives - the `or` of regexps
# WARNING: They are DIFFERENT from PCRE regexps.
so 'abc' ~~ / a [ b | y ] c /; # `True`. Either "b" or "y".
so 'ayc' ~~ / a [ b | y ] c /; # `True`. Obviously enough ...
+# The difference between this `|` and the one you're used to is LTM.
+# LTM means "Longest Token Matching". This means that the engine will always
+# try to match as much as possible in the strng
+'foo' ~~ / fo | foo /; # `foo`, because it's longer.
+# To decide which part is the "longest", it first splits the regex in two parts:
+# The "declarative prefix" (the part that can be statically analyzed)
+# and the procedural parts.
+# Declarative prefixes include alternations (`|`), conjuctions (`&`),
+# sub-rule calls (not yet introduced), literals, characters classes and quantifiers.
+# The latter include everything else: back-references, code assertions,
+# and other things that can't traditionnaly be represented by normal regexps.
+#
+# Then, all the alternatives are tried at once, and the longest wins.
+# Exemples:
+# DECLARATIVE | PROCEDURAL
+/ 'foo' \d+ [ <subrule1> || <subrule2> ] /;
+# DECLARATIVE (nested groups are not a problem)
+/ \s* [ \w & b ] [ c | d ] /;
+# However, closures and recursion (of named regexps) are procedural.
+# ... There are also more complicated rules, like specificity
+# (literals win over character classes)
+
+# Note: the first-matching `or` still exists, but is now spelled `||`
+'foo' ~~ / fo || foo /; # `fo` now.
+
+
+
+
### Extra: the MAIN subroutime
# The `MAIN` subroutine is called when you run a Perl 6 file directly.
# It's very powerful, because Perl 6 actually parses the argument
@@ -1317,7 +1454,7 @@ sub MAIN($name) { say "Hello, you !" }
# t.pl <name>
# And since it's a regular Perl 6 sub, you can haz multi-dispatch:
-# (using a "Bool" for the named argument so that we get `--replace`
+# (using a "Bool" for the named argument so that we can do `--replace`
# instead of `--replace=1`)
subset File of Str where *.IO.d; # convert to IO object to check the file exists
diff --git a/python.html.markdown b/python.html.markdown
index 9057dde2..390c7b76 100644
--- a/python.html.markdown
+++ b/python.html.markdown
@@ -57,9 +57,17 @@ to Python 2.x. Look for another tour of Python 3 soon!
# Enforce precedence with parentheses
(1 + 3) * 2 # => 8
-# Boolean values are primitives
-True
-False
+# Boolean Operators
++# Note "and" and "or" are case-sensitive
++True and False #=> False
++False or True #=> True
++
++# Note using Bool operators with ints
++0 and 2 #=> 0
++-5 or 0 #=> -5
++0 == False #=> True
++2 == True #=> False
+1 == True #=> True
# negate with not
not True # => False
diff --git a/python3.html.markdown b/python3.html.markdown
index f6babaff..a94f4eae 100644
--- a/python3.html.markdown
+++ b/python3.html.markdown
@@ -61,6 +61,18 @@ False
not True # => False
not False # => True
+# Boolean Operators
+# Note "and" and "or" are case-sensitive
+True and False #=> False
+False or True #=> True
+
+# Note using Bool operators with ints
+0 and 2 #=> 0
+-5 or 0 #=> -5
+0 == False #=> True
+2 == True #=> False
+1 == True #=> True
+
# Equality is ==
1 == 1 # => True
2 == 1 # => False
@@ -127,7 +139,8 @@ bool({}) #=> False
# Python has a print function
print("I'm Python. Nice to meet you!")
-# No need to declare variables before assigning to them. Convention is to use lower_case_with_underscores
+# No need to declare variables before assigning to them.
+# Convention is to use lower_case_with_underscores
some_var = 5
some_var # => 5
@@ -176,7 +189,8 @@ li[::-1] # => [3, 4, 2, 1]
del li[2] # li is now [1, 2, 3]
# You can add lists
-li + other_li # => [1, 2, 3, 4, 5, 6] - Note: values for li and for other_li are not modified.
+# Note: values for li and for other_li are not modified.
+li + other_li # => [1, 2, 3, 4, 5, 6]
# Concatenate lists with "extend()"
li.extend(other_li) # Now li is [1, 2, 3, 4, 5, 6]
@@ -215,14 +229,17 @@ filled_dict = {"one": 1, "two": 2, "three": 3}
# Look up values with []
filled_dict["one"] # => 1
-# Get all keys as a list with "keys()". We need to wrap the call in list() because we are getting back an iterable. We'll talk about those later.
-list(filled_dict.keys()) # => ["three", "two", "one"]
+# Get all keys as a list with "keys()".
+# We need to wrap the call in list() because we are getting back an iterable. We'll talk about those later.
# Note - Dictionary key ordering is not guaranteed.
# Your results might not match this exactly.
+list(filled_dict.keys()) # => ["three", "two", "one"]
+
# Get all values as a list with "values()". Once again we need to wrap it in list() to get it out of the iterable.
-list(filled_dict.values()) # => [3, 2, 1]
# Note - Same as above regarding key ordering.
+list(filled_dict.values()) # => [3, 2, 1]
+
# Check for existence of keys in a dictionary with "in"
"one" in filled_dict # => True
@@ -242,6 +259,10 @@ filled_dict.get("four", 4) # => 4
filled_dict.setdefault("five", 5) # filled_dict["five"] is set to 5
filled_dict.setdefault("five", 6) # filled_dict["five"] is still 5
+# Adding to a dictionary
+filled_dict.update({"four":4}) #=> {"one": 1, "two": 2, "three": 3, "four": 4}
+#filled_dict["four"] = 4 #another way to add to dict
+
# Remove keys from a dictionary with del
del filled_dict["one"] # Removes the key "one" from filled dict
@@ -458,6 +479,7 @@ map(add_10, [1, 2, 3]) # => [11, 12, 13]
filter(lambda x: x > 5, [3, 4, 5, 6, 7]) # => [6, 7]
# We can use list comprehensions for nice maps and filters
+# List comprehension stores the output as a list which can itself be a nested list
[add_10(i) for i in [1, 2, 3]] # => [11, 12, 13]
[x for x in [3, 4, 5, 6, 7] if x > 5] # => [6, 7]
diff --git a/tmux.html.markdown b/tmux.html.markdown
new file mode 100644
index 00000000..8d7aa752
--- /dev/null
+++ b/tmux.html.markdown
@@ -0,0 +1,244 @@
+---
+category: tool
+tool: tmux
+contributors:
+ - ["kaernyk", "http://github.com/kaernyk"]
+filename: LearnTmux.txt
+---
+
+
+<a href="http://tmux.sourceforge.net/">
+tmux</a> is a terminal multiplexer: it enables a number of terminals
+to be created, accessed, and controlled from a single screen. tmux
+may be detached from a screen and continue running in the background
+then later reattached.
+
+
+```
+ tmux [command] # Run a command
+ # 'tmux' with no commands will create a new
+ session
+
+ new # Create a new session
+ -s "Session" # Create named session
+ -n "Window" # Create named Window
+ -c "/dir" # Start in target directory
+
+ attach # Attach last/available session
+ -t "#" # Attach target session
+ -d # Detach the session from other instances
+
+ ls # List open sessions
+ -a # List all open sessions
+
+ lsw # List windows
+ -a # List all windows
+ -s # List all windows in session
+
+ lsp # List panes
+ -a # List all panes
+ -s # List all panes in session
+ -t # List app panes in target
+
+ kill-window # Kill current window
+ -t "#" # Kill target window
+ -a # Kill all windows
+ -a -t "#" # Kill all windows but the target
+
+ kill-session # Kill current session
+ -t "#" # Kill target session
+ -a # Kill all sessions
+ -a -t "#" # Kill all sessions but the target
+
+
+
+## Key Bindings
+
+# The method of controlling an attached tmux session is via key
+# combinations called 'Prefix' keys.
+
+----------------------------------------------------------------------
+ (C-b) = Ctrl + b # 'Prefix' combination required to use keybinds
+
+ (M-1) = Meta + 1 -or- Alt + 1
+----------------------------------------------------------------------
+
+ ? # List all key bindings
+ : # Enter the tmux command prompt
+ r # Force redraw of the attached client
+ c # Create a new window
+
+ ! # Break the current pane out of the window.
+ % # Split the current pane into two, left and right
+ " # Split the current pane into two, top and bottom
+
+ n # Change to the next window
+ p # Change to the previous window
+ { # Swap the current pane with the previous pane
+ } # Swap the current pane with the next pane
+
+ s # Select a new session for the attached client
+ interactively
+ w # Choose the current window interactively
+ 0 to 9 # Select windows 0 to 9
+
+ d # Detach the current client
+ D # Choose a client to detach
+
+ & # Kill the current window
+ x # Kill the current pane
+
+ Up, Down # Change to the pane above, below, left, or right
+ Left, Right
+
+ M-1 to M-5 # Arrange panes:
+ # 1) even-horizontal
+ # 2) even-vertical
+ # 3) main-horizontal
+ # 4) main-vertical
+ # 5) tiled
+
+ C-Up, C-Down # Resize the current pane in steps of one cell
+ C-Left, C-Right
+
+ M-Up, M-Down # Resize the current pane in steps of five cells
+ M-Left, M-Right
+
+
+
+### Configuring ~/.tmux.conf
+
+ tmux.conf can be used to set options automatically on start up, much
+like how .vimrc or init.el are used.
+
+# Example tmux.conf
+# 2014.9
+
+
+### Keybinds
+######################################################################
+
+# Unbind C-b as the default prefix
+unbind-key C-befix C-a
+
+# Return to previous window when prefix is pressed twice
+bind-key C-a last-window
+bind-key ` last-window
+
+# Allow swapping C-a and ` using F11/F12
+bind-key F11 set-option -g prefix C-a
+bind-key F12 set-option -g prefix `
+
+# Activate inner-most session (when nesting tmux)
+# to send commands
+bind-key a send-prefix
+
+# Index Start
+set -g base-index 1
+
+# Window Cycle/Swap
+bind e previous-window
+bind f next-window
+bind E swap-window -t -1
+bind F swap-window -t +1
+
+# easy-to-remember split pane commands
+bind | split-window -h
+bind - split-window -v
+unbind '"'
+unbind %
+
+# moving between panes with vim movement keys
+bind h select-pane -L
+bind j select-pane -D
+bind k select-pane -U
+bind l select-pane -R
+
+
+### Theme
+#####################################################################
+
+# Statusbar Color Palette
+set-option -g status-justify left
+set-option -g status-bg black
+set-option -g status-fg white
+set-option -g status-left-length 40
+set-option -g status-right-length 80
+
+# Pane Border Color Palette
+set-option -g pane-active-border-fg green
+set-option -g pane-active-border-bg black
+set-option -g pane-border-fg white
+set-option -g pane-border-bg black
+
+# Message Color Palette
+set-option -g message-fg black
+set-option -g message-bg green
+
+# Window Status Color Palette
+setw -g window-status-bg black
+setw -g window-status-current-fg green
+setw -g window-status-bell-attr default
+setw -g window-status-bell-fg red
+setw -g window-status-content-attr default
+setw -g window-status-content-fg yellow
+setw -g window-status-activity-attr default
+setw -g window-status-activity-fg yellow
+
+
+### UI
+######################################################################
+
+# Statusbar
+set-option -g status-utf8 on
+
+# Keybind preference
+setw -g mode-keys vi
+set-option -g status-keys vi
+
+# Notification
+setw -g monitor-activity on
+set -g visual-activity on
+set-option -g bell-action any
+set-option -g visual-bell off
+
+# Mouse
+setw -g mode-mouse on
+set-option -g mouse-select-pane on
+set -g mouse-resize-pane on
+set -g mouse-select-window on
+
+# Automatically set window titles
+set-option -g set-titles on
+
+# window number,program name,active (or not)
+set-option -g set-titles-string '#H:#S.#I.#P #W #T'
+
+# Statusbar Adjustments
+set -g status-left '#[fg=red]#H#[fg=green]:#[fg=white]#S #[fg=green]][#[default]'
+set -g status-interval 3
+
+# Statusbar with right-aligned Date / Time
+#set -g status-right '#[fg=green]][#[fg=white] #T #[fg=green]][ #[fg=blue]%Y-%m-%d #[fg=white]%H:%M#[default]'
+
+# Show performance counters in statusbar
+# Requires https://github.com/thewtex/tmux-mem-cpu-load/
+#set -g status-right '#[fg=green]][#[fg=white] #(tmux-mem-cpu-load 5 4) #[fg=green]][ #[fg=yellow]%H:%M#[default]'
+
+
+### Misc
+######################################################################
+
+# Scrollback/History limit
+set -g history-limit 4096
+
+bind r source-file ~/.tmux.conf
+```
+
+### External Resources
+
+<a href="http://tmux.sourceforge.net/">Tmux | Home</a><br>
+<a href="http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/tmux.1?query=tmux">Tmux Manual page</a><br>
+<a href="http://wiki.gentoo.org/wiki/Tmux">Archlinux Wiki</a><br>
+<a href="https://wiki.archlinux.org/index.php/Tmux">Gentoo Wiki</a><br>
+<a href="https://stackoverflow.com/questions/11558907/is-there-a-better-way-to-display-cpu-usage-in-tmux">Display CPU/MEM % in statusbar</a><br>
diff --git a/zh-cn/livescript-cn.html.markdown b/zh-cn/livescript-cn.html.markdown
new file mode 100644
index 00000000..fea00bc1
--- /dev/null
+++ b/zh-cn/livescript-cn.html.markdown
@@ -0,0 +1,322 @@
+---
+language: LiveScript
+filename: learnLivescript.ls
+contributors:
+ - ["Christina Whyte", "http://github.com/kurisuwhyte/"]
+translators:
+ - ["ShengDa Lyu", "http://github.com/SDLyu/"]
+lang: zh-cn
+---
+
+LiveScript 是一种具有函数式特性且编译成 JavaScript 的语言,能对应 JavaScript 的基本语法。
+还有些额外的特性如:柯里化,组合函数,模式匹配,还有借镜于 Haskell,F# 和 Scala 的许多特点。
+
+LiveScript 诞生于 [Coco][],而 Coco 诞生于 [CoffeeScript][]。
+LiveScript 目前已释出稳定版本,开发中的新版本将会加入更多特性。
+
+[Coco]: http://satyr.github.io/coco/
+[CoffeeScript]: http://coffeescript.org/
+
+非常期待您的反馈,你可以通过
+[@kurisuwhyte](https://twitter.com/kurisuwhyte) 与我连系 :)
+
+
+```coffeescript
+# 与 CoffeeScript 一样,LiveScript 使用 # 单行注解。
+
+/*
+ 多行注解与 C 相同。使用注解可以避免被当成 JavaScript 输出。
+*/
+```
+```coffeescript
+# 语法的部份,LiveScript 使用缩进取代 {} 来定义区块,
+# 使用空白取代 () 来执行函数。
+
+
+########################################################################
+## 1. 值类型
+########################################################################
+
+# `void` 取代 `undefined` 表示未定义的值
+void # 与 `undefined` 等价但更安全(不会被覆写)
+
+# 空值则表示成 Null。
+null
+
+
+# 最基本的值类型数据是罗辑类型:
+true
+false
+
+# 罗辑类型的一些别名,等价于前者:
+on; off
+yes; no
+
+
+# 数字与 JS 一样,使用倍精度浮点数表示。
+10
+0.4 # 开头的 0 是必要的
+
+
+# 可以使用底线及单位后缀提高可读性,编译器会自动略过底线及单位后缀。
+12_344km
+
+
+# 字串与 JS 一样,是一种不可变的字元序列:
+"Christina" # 单引号也可以!
+"""Multi-line
+ strings
+ are
+ okay
+ too."""
+
+# 在前面加上 \ 符号也可以表示字串:
+\keyword # => 'keyword'
+
+
+# 数组是值的有序集合。
+fruits =
+ * \apple
+ * \orange
+ * \pear
+
+# 可以用 [] 简洁地表示数组:
+fruits = [ \apple, \orange, \pear ]
+
+
+# 你可以更方便地建立字串数组,并使用空白区隔元素。
+fruits = <[ apple orange pear ]>
+
+# 以 0 为起始值的数组下标获取元素:
+fruits[0] # => "apple"
+
+
+# 对象是无序键值对集合(更多给节将在下面章节讨论)。
+person =
+ name: "Christina"
+ likes:
+ * "kittens"
+ * "and other cute stuff"
+
+# 你也可以用更简洁的方式表示对象:
+person = {name: "Christina", likes: ["kittens", "and other cute stuff"]}
+
+# 可以通过键值获取值:
+person.name # => "Christina"
+person["name"] # => "Christina"
+
+
+# 正则表达式的使用跟 JavaScript 一样:
+trailing-space = /\s$/ # dashed-words 变成 dashedWords
+
+# 你也可以用多行描述表达式!(注解和空白会被忽略)
+funRE = //
+ function\s+(.+) # name
+ \s* \((.*)\) \s* # arguments
+ { (.*) } # body
+ //
+
+
+########################################################################
+## 2. 基本运算
+########################################################################
+
+# 数值操作符与 JavaScript 一样:
+1 + 2 # => 3
+2 - 1 # => 1
+2 * 3 # => 6
+4 / 2 # => 2
+3 % 2 # => 1
+
+
+# 比较操作符大部份也一样,除了 `==` 等价于 JS 中的 `===`,
+# JS 中的 `==` 在 LiveScript 里等价于 `~=`,
+# `===` 能进行对象、数组和严格比较。
+2 == 2 # => true
+2 == "2" # => false
+2 ~= "2" # => true
+2 === "2" # => false
+
+[1,2,3] == [1,2,3] # => false
+[1,2,3] === [1,2,3] # => true
+
++0 == -0 # => true
++0 === -0 # => false
+
+# 其它关系操作符包括 <、<=、> 和 >=
+
+# 罗辑值可以通过 `or`、`and` 和 `not` 结合:
+true and false # => false
+false or true # => true
+not false # => true
+
+
+# 集合也有一些便利的操作符
+[1, 2] ++ [3, 4] # => [1, 2, 3, 4]
+'a' in <[ a b c ]> # => true
+'name' of { name: 'Chris' } # => true
+
+
+########################################################################
+## 3. 函数
+########################################################################
+
+# 因为 LiveScript 是函数式特性的语言,你可以期待函数在语言里被高规格的对待。
+add = (left, right) -> left + right
+add 1, 2 # => 3
+
+# 加上 ! 防止函数执行后的返回值
+two = -> 2
+two!
+
+# LiveScript 与 JavaScript 一样使用函式作用域,且一样拥有闭包的特性。
+# 与 JavaScript 不同的地方在于,`=` 变量赋值时,左边的对象永远不用变量宣告。
+
+# `:=` 操作符允许*重新賦值*父作用域里的变量。
+
+
+# 你可以解构函数的参数,从不定长度的参数结构里获取感兴趣的值。
+tail = ([head, ...rest]) -> rest
+tail [1, 2, 3] # => [2, 3]
+
+# 你也可以使用一元或二元操作符转换参数。当然也可以预设传入的参数值。
+foo = (a = 1, b = 2) -> a + b
+foo! # => 3
+
+# 你可以以拷贝的方式传入参数来避免副作用,例如:
+copy = (^^target, source) ->
+ for k,v of source => target[k] = v
+ target
+a = { a: 1 }
+copy a, { b: 2 } # => { a: 1, b: 2 }
+a # => { a: 1 }
+
+
+# 使用长箭号取代短箭号来柯里化一个函数:
+add = (left, right) --> left + right
+add1 = add 1
+add1 2 # => 3
+
+# 函式里有一个隐式的 `it` 变量,意谓着你不用宣告它。
+identity = -> it
+identity 1 # => 1
+
+# 操作符在 LiveScript 里不是一個函数,但你可以简单地将它们转换成函数!
+# Enter the operator sectioning:
+divide-by-2 = (/ 2)
+[2, 4, 8, 16].map(divide-by-2) .reduce (+)
+
+
+# LiveScript 里不只有应用函数,如同其它良好的函数式语言,你可以合并函数获得更多发挥:
+double-minus-one = (- 1) . (* 2)
+
+# 除了普通的数学公式合并 `f . g` 之外,还有 `>>` 和 `<<` 操作符定义函数的合并顺序。
+double-minus-one = (* 2) >> (- 1)
+double-minus-one = (- 1) << (* 2)
+
+
+# 说到合并函数的参数, LiveScript 使用 `|>` 和 `<|` 操作符将参数传入:
+map = (f, xs) --> xs.map f
+[1 2 3] |> map (* 2) # => [2 4 6]
+
+# 你也可以选择填入值的位置,只需要使用底线 _ 标记:
+reduce = (f, xs, initial) --> xs.reduce f, initial
+[1 2 3] |> reduce (+), _, 0 # => 6
+
+
+# 你也能使 _ 让任何函数变成偏函数应用:
+div = (left, right) -> left / right
+div-by-2 = div _, 2
+div-by-2 4 # => 2
+
+
+# 最后,也很重要的,LiveScript 拥有後呼叫特性, 可以是基於回调的代码
+# (你可以试试其它函数式特性的解法,比如 Promises):
+readFile = (name, f) -> f name
+a <- readFile 'foo'
+b <- readFile 'bar'
+console.log a + b
+
+# 等同於:
+readFile 'foo', (a) -> readFile 'bar', (b) -> console.log a + b
+
+
+########################################################################
+## 4. 模式、判断和流程控制
+########################################################################
+
+# 流程控制可以使用 `if...else` 表达式:
+x = if n > 0 then \positive else \negative
+
+# 除了 `then` 你也可以使用 `=>`
+x = if n > 0 => \positive
+ else \negative
+
+# 过於复杂的流程可以用 `switch` 表达式代替:
+y = {}
+x = switch
+ | (typeof y) is \number => \number
+ | (typeof y) is \string => \string
+ | 'length' of y => \array
+ | otherwise => \object # `otherwise` 和 `_` 是等价的。
+
+# 函数主体、宣告式和赋值式可以表式成 `switch`,这可以省去一些代码:
+take = (n, [x, ...xs]) -->
+ | n == 0 => []
+ | _ => [x] ++ take (n - 1), xs
+
+
+########################################################################
+## 5. 推导式
+########################################################################
+
+# 在 JavaScript 的标准函式库里有一些辅助函数能帮助处理列表及对象
+#(LiveScript 则带有一个 prelude.ls ,作为标准函式库的补充 ),
+# 推导式能让你使用优雅的语法且快速地处理这些事:
+oneToTwenty = [1 to 20]
+evens = [x for x in oneToTwenty when x % 2 == 0]
+
+# 在推导式里 `when` 和 `unless` 可以当成过滤器使用。
+
+# 对象推导式在使用上也是同样的方式,差别在于你使用的是对象而不是数组:
+copy = { [k, v] for k, v of source }
+
+
+########################################################################
+## 6. OOP
+########################################################################
+
+# 虽然 LiveScript 是一门函数式语言,但具有一些命令式及面向对象的特性。
+# 像是 class 语法和一些借镜於 CoffeeScript 的类别继承语法糖:
+class Animal
+ (@name, kind) ->
+ @kind = kind
+ action: (what) -> "*#{@name} (a #{@kind}) #{what}*"
+
+class Cat extends Animal
+ (@name) -> super @name, 'cat'
+ purr: -> @action 'purrs'
+
+kitten = new Cat 'Mei'
+kitten.purr! # => "*Mei (a cat) purrs*"
+
+# 除了类别的单一继承模式之外,还提供了像混入 (Mixins) 这种特性。
+# Mixins 在语言里被当成普通对象:
+Huggable =
+ hug: -> @action 'is hugged'
+
+class SnugglyCat extends Cat implements Huggable
+
+kitten = new SnugglyCat 'Purr'
+kitten.hug! # => "*Mei (a cat) is hugged*"
+```
+
+## 延伸阅读
+
+LiveScript 还有许多强大之处,但这些应该足够启发你写些小型函数式程式了。
+[LiveScript](http://livescript.net/)有更多关于 LiveScript 的资讯
+和线上编译器等着你来试!
+
+你也可以参考
+[prelude.ls](http://gkz.github.io/prelude-ls/),和一些 `#livescript`
+的网络聊天室频道。
diff --git a/zh-cn/ruby-cn.html.markdown b/zh-cn/ruby-cn.html.markdown
index 3c47f3f9..99250b43 100644
--- a/zh-cn/ruby-cn.html.markdown
+++ b/zh-cn/ruby-cn.html.markdown
@@ -40,7 +40,7 @@ translators:
1.+(3) #=> 4
10.* 5 #=> 50
-# 特殊的只也是对象
+# 特殊的值也是对象
nil # 空
true # 真
false # 假