summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--css.html.markdown4
-rw-r--r--de-de/bash-de.html.markdown2
-rw-r--r--es-es/csharp-es.html.markdown2
-rw-r--r--es-es/learnsmallbasic-es.html.markdown2
-rw-r--r--fr-fr/dynamic-programming-fr.html.markdown16
-rw-r--r--fr-fr/java-fr.html.markdown2
-rw-r--r--haskell.html.markdown17
-rw-r--r--haxe.html.markdown21
-rw-r--r--java.html.markdown103
-rw-r--r--javascript.html.markdown9
-rw-r--r--lua.html.markdown5
-rw-r--r--montilang.html.markdown233
-rw-r--r--moonscript.html.markdown570
-rw-r--r--pt-br/solidity-pt.html.markdown2
-rw-r--r--pythonstatcomp.html.markdown18
-rw-r--r--ro-ro/elixir-ro.html.markdown2
-rw-r--r--ru-ru/jquery-ru.html.markdown127
-rw-r--r--ru-ru/markdown-ru.html.markdown1
-rw-r--r--ruby-ecosystem.html.markdown32
-rw-r--r--scala.html.markdown2
-rw-r--r--solidity.html.markdown4
-rw-r--r--tests/encoding.rb32
-rw-r--r--tests/yaml.rb21
-rw-r--r--tr-tr/c++-tr.html.markdown2
-rw-r--r--tr-tr/git-tr.html.markdown2
25 files changed, 1160 insertions, 71 deletions
diff --git a/css.html.markdown b/css.html.markdown
index 3b378d44..64dc097c 100644
--- a/css.html.markdown
+++ b/css.html.markdown
@@ -135,6 +135,10 @@ selector::after {}
.parent * { } /* all descendants */
.parent > * { } /* all children */
+/* Group any number of selectors to define styles that affect all selectors
+ in the group */
+selector1, selector2 { }
+
/* ####################
## PROPERTIES
#################### */
diff --git a/de-de/bash-de.html.markdown b/de-de/bash-de.html.markdown
index 7928b136..7a0db157 100644
--- a/de-de/bash-de.html.markdown
+++ b/de-de/bash-de.html.markdown
@@ -180,7 +180,7 @@ esac
# 'for' Schleifen iterieren über die angegebene Zahl von Argumenten:
# Der Inhalt von $Variable wird dreimal ausgedruckt.
-for $Variable in {1..3}
+for Variable in {1..3}
do
echo "$Variable"
done
diff --git a/es-es/csharp-es.html.markdown b/es-es/csharp-es.html.markdown
index 5d730497..72a0f90c 100644
--- a/es-es/csharp-es.html.markdown
+++ b/es-es/csharp-es.html.markdown
@@ -5,7 +5,7 @@ contributors:
- ["Irfan Charania", "https://github.com/irfancharania"]
- ["Max Yankov", "https://github.com/golergka"]
translators:
- - ["Olfran Jiménez", "https://twitter.com/neslux"]
+ - ["Olfran Jiménez", "https://twitter.com/neslux"]
lang: es-es
---
diff --git a/es-es/learnsmallbasic-es.html.markdown b/es-es/learnsmallbasic-es.html.markdown
index 21208792..ff320afb 100644
--- a/es-es/learnsmallbasic-es.html.markdown
+++ b/es-es/learnsmallbasic-es.html.markdown
@@ -18,7 +18,7 @@ SmallBASIC fue desarrollado originalmente por Nicholas Christopoulos a finales d
Versiones de SmallBASIC se han hecho para una serie dispositivos de mano antiguos, incluyendo Franklin eBookman y el Nokia 770. También se han publicado varias versiones de escritorio basadas en una variedad de kits de herramientas GUI, algunas de las cuales han desaparecido. Las plataformas actualmente soportadas son Linux y Windows basadas en SDL2 y Android basadas en NDK. También está disponible una versión de línea de comandos de escritorio, aunque no suele publicarse en formato binario.
Alrededor de 2008 una gran corporación lanzó un entorno de programación BASIC con un nombre de similar. SmallBASIC no está relacionado con este otro proyecto.
-```SmallBASIC
+```
REM Esto es un comentario
' y esto tambien es un comentario
diff --git a/fr-fr/dynamic-programming-fr.html.markdown b/fr-fr/dynamic-programming-fr.html.markdown
index 24e8c95f..b3660ac9 100644
--- a/fr-fr/dynamic-programming-fr.html.markdown
+++ b/fr-fr/dynamic-programming-fr.html.markdown
@@ -8,7 +8,6 @@ translators:
lang: fr-fr
---
-
# Programmation dynamique
## Introduction
@@ -17,9 +16,9 @@ La programmation dynamique est une technique très efficace pour résoudre une c
## Moyens de résoudre ces problèmes
-1.) *De haut en bas* : Commençons à résoudre le problème en le séparant en morceaux. Si nous voyons que le problème a déjà été résolu, alors nous retournons la réponse précédemment sauvegardée. Si le problème n'a pas été résolu, alors nous le résolvons et sauvegardons la réponse. C'est généralement facile et intuitif de réfléchir de cette façon. Cela s'appelle la Mémorisation.
+1. *De haut en bas* : Commençons à résoudre le problème en le séparant en morceaux. Si nous voyons que le problème a déjà été résolu, alors nous retournons la réponse précédemment sauvegardée. Si le problème n'a pas été résolu, alors nous le résolvons et sauvegardons la réponse. C'est généralement facile et intuitif de réfléchir de cette façon. Cela s'appelle la Mémorisation.
-2.) *De bas en haut* : Il faut analyser le problème et trouver les sous-problèmes, et l'ordre dans lequel il faut les résoudre. Ensuite, nous devons résoudre les sous-problèmes et monter jusqu'au problème que nous voulons résoudre. De cette façon, nous sommes assurés que les sous-problèmes sont résolus avant de résoudre le vrai problème. Cela s'appelle la Programmation Dynamique.
+2. *De bas en haut* : Il faut analyser le problème et trouver les sous-problèmes, et l'ordre dans lequel il faut les résoudre. Ensuite, nous devons résoudre les sous-problèmes et monter jusqu'au problème que nous voulons résoudre. De cette façon, nous sommes assurés que les sous-problèmes sont résolus avant de résoudre le vrai problème. Cela s'appelle la Programmation Dynamique.
## Exemple de Programmation Dynamique
@@ -27,7 +26,7 @@ Le problème de la plus grande sous-chaîne croissante est de trouver la plus gr
Premièrement, nous avons à trouver la valeur de la plus grande sous-chaîne (LSi) à chaque index `i`, avec le dernier élément de la sous-chaîne étant ai. Alors, la plus grande sous-chaîne sera le plus gros LSi. Pour commencer, LSi est égal à 1, car ai est le seul élément de la chaîne (le dernier). Ensuite, pour chaque `j` tel que `j<i` et `aj<ai`, nous trouvons le plus grand LSj et ajoutons le à LSi. L'algorithme fonctionne en temps *O(n2)*.
Pseudo-code pour trouver la longueur de la plus grande sous-chaîne croissante :
-La complexité de cet algorithme peut être réduite en utilisant une meilleure structure de données qu'un tableau. Par exemple, si nous sauvegardions le tableau d'origine, ou une variable comme plus_grande_chaîne_jusqu'à_maintenant et son index, nous pourrions sauver beaucoup de temps.
+La complexité de cet algorithme peut être réduite en utilisant une meilleure structure de données qu'un tableau. Par exemple, si nous sauvegardions le tableau d'origine, ou une variable comme `plus_grande_chaîne_jusqu'à_maintenant` et son index, nous pourrions sauver beaucoup de temps.
Le même concept peut être appliqué pour trouver le chemin le plus long dans un graphe acyclique orienté.
@@ -43,12 +42,9 @@ Le même concept peut être appliqué pour trouver le chemin le plus long dans u
### Problèmes classiques de programmation dynamique
-L'algorithme de Floyd Warshall(EN)) - Tutorial and C Program source code:http://www.thelearningpoint.net/computer-science/algorithms-all-to-all-shortest-paths-in-graphs---floyd-warshall-algorithm-with-c-program-source-code
-
-Problème du sac à dos(EN) - Tutorial and C Program source code: http://www.thelearningpoint.net/computer-science/algorithms-dynamic-programming---the-integer-knapsack-problem
-
-
-Plus longue sous-chaîne commune(EN) - Tutorial and C Program source code : http://www.thelearningpoint.net/computer-science/algorithms-dynamic-programming---longest-common-subsequence
+- L'algorithme de Floyd Warshall(EN)) - Tutorial and C Program source code:http://www.thelearningpoint.net/computer-science/algorithms-all-to-all-shortest-paths-in-graphs---floyd-warshall-algorithm-with-c-program-source-code
+- Problème du sac à dos(EN) - Tutorial and C Program source code: http://www.thelearningpoint.net/computer-science/algorithms-dynamic-programming---the-integer-knapsack-problem
+- Plus longue sous-chaîne commune(EN) - Tutorial and C Program source code : http://www.thelearningpoint.net/computer-science/algorithms-dynamic-programming---longest-common-subsequence
## Online Resources
diff --git a/fr-fr/java-fr.html.markdown b/fr-fr/java-fr.html.markdown
index d0f91611..d6c68343 100644
--- a/fr-fr/java-fr.html.markdown
+++ b/fr-fr/java-fr.html.markdown
@@ -11,7 +11,7 @@ contributors:
- ["Michael Dähnert", "https://github.com/JaXt0r"]
- ["Rob Rose", "https://github.com/RobRoseKnows"]
- ["Sean Nam", "https://github.com/seannam"]
-filename: JavaFr.java
+filename: java-fr.java
translators:
- ['Mathieu Gemard', 'https://github.com/mgemard']
lang: fr-fr
diff --git a/haskell.html.markdown b/haskell.html.markdown
index 266cf11b..90d47c27 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -124,6 +124,9 @@ last [1..5] -- 5
fst ("haskell", 1) -- "haskell"
snd ("haskell", 1) -- 1
+-- pair element accessing does not work on n-tuples (i.e. triple, quadruple, etc)
+snd ("snd", "can't touch this", "da na na na") -- error! see function below
+
----------------------------------------------------
-- 3. Functions
----------------------------------------------------
@@ -159,8 +162,8 @@ fib 1 = 1
fib 2 = 2
fib x = fib (x - 1) + fib (x - 2)
--- Pattern matching on tuples:
-foo (x, y) = (x + 1, y + 2)
+-- Pattern matching on tuples
+sndOfTriple (_, y, _) = y -- use a wild card (_) to bypass naming unused value
-- Pattern matching on lists. Here `x` is the first element
-- in the list, and `xs` is the rest of the list. We can write
@@ -203,11 +206,11 @@ foo = (4*) . (10+)
foo 5 -- 60
-- fixing precedence
--- Haskell has an operator called `$`. This operator applies a function
--- to a given parameter. In contrast to standard function application, which
--- has highest possible priority of 10 and is left-associative, the `$` operator
+-- Haskell has an operator called `$`. This operator applies a function
+-- to a given parameter. In contrast to standard function application, which
+-- has highest possible priority of 10 and is left-associative, the `$` operator
-- has priority of 0 and is right-associative. Such a low priority means that
--- the expression on its right is applied as the parameter to the function on its left.
+-- the expression on its right is applied as a parameter to the function on its left.
-- before
even (fib 7) -- false
@@ -223,7 +226,7 @@ even . fib $ 7 -- false
-- 5. Type signatures
----------------------------------------------------
--- Haskell has a very strong type system, and every valid expression has a type.
+-- Haskell has a very strong type system, and every valid expression has a type.
-- Some basic types:
5 :: Integer
diff --git a/haxe.html.markdown b/haxe.html.markdown
index df2a1e78..afb9d1a3 100644
--- a/haxe.html.markdown
+++ b/haxe.html.markdown
@@ -770,19 +770,18 @@ class UsingExample {
```
We're still only scratching the surface here of what Haxe can do. For a formal
-overview of all Haxe features, checkout the [online
-manual](http://haxe.org/manual), the [online API](http://api.haxe.org/), and
-"haxelib", the [haxe library repo] (http://lib.haxe.org/).
+overview of all Haxe features, see the [manual](https://haxe.org/manual) and
+the [API docs](https://api.haxe.org/). For a comprehensive directory of available
+third-party Haxe libraries, see [Haxelib](https://lib.haxe.org/).
For more advanced topics, consider checking out:
-* [Abstract types](http://haxe.org/manual/abstracts)
-* [Macros](http://haxe.org/manual/macros), and [Compiler Macros](http://haxe.org/manual/macros_compiler)
-* [Tips and Tricks](http://haxe.org/manual/tips_and_tricks)
-
-
-Finally, please join us on [the mailing list](https://groups.google.com/forum/#!forum/haxelang), on IRC [#haxe on
-freenode](http://webchat.freenode.net/), or on
-[Google+](https://plus.google.com/communities/103302587329918132234).
+* [Abstract types](https://haxe.org/manual/types-abstract.html)
+* [Macros](https://haxe.org/manual/macro.html)
+* [Compiler Features](https://haxe.org/manual/cr-features.html)
+Finally, please join us on [the Haxe forum](https://community.haxe.org/),
+on IRC [#haxe on
+freenode](http://webchat.freenode.net/), or on the
+[Haxe Gitter chat](https://gitter.im/HaxeFoundation/haxe).
diff --git a/java.html.markdown b/java.html.markdown
index ab2be4a2..ca0b04c2 100644
--- a/java.html.markdown
+++ b/java.html.markdown
@@ -11,6 +11,7 @@ contributors:
- ["Michael Dähnert", "https://github.com/JaXt0r"]
- ["Rob Rose", "https://github.com/RobRoseKnows"]
- ["Sean Nam", "https://github.com/seannam"]
+ - ["Shawn M. Hanes", "https://github.com/smhanes15"]
filename: LearnJava.java
---
@@ -858,6 +859,108 @@ public class EnumTest {
// The enum body can include methods and other fields.
// You can see more at https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
+// Getting Started with Lambda Expressions
+//
+// New to Java version 8 are lambda expressions. Lambdas are more commonly found
+// in functional programming languages, which means they are methods which can
+// be created without belonging to a class, passed around as if it were itself
+// an object, and executed on demand.
+//
+// Final note, lambdas must implement a functional interface. A functional
+// interface is one which has only a single abstract method declared. It can
+// have any number of default methods. Lambda expressions can be used as an
+// instance of that functional interface. Any interface meeting the requirements
+// is treated as a functional interface. You can read more about interfaces
+// above.
+//
+import java.util.Map;
+import java.util.HashMap;
+import java.util.function.*;
+import java.security.SecureRandom;
+
+public class Lambdas {
+ public static void main(String[] args) {
+ // Lambda declaration syntax:
+ // <zero or more parameters> -> <expression body or statement block>
+
+ // We will use this hashmap in our examples below.
+ Map<String, String> planets = new HashMap<>();
+ planets.put("Mercury", "87.969");
+ planets.put("Venus", "224.7");
+ planets.put("Earth", "365.2564");
+ planets.put("Mars", "687");
+ planets.put("Jupiter", "4,332.59");
+ planets.put("Saturn", "10,759");
+ planets.put("Uranus", "30,688.5");
+ planets.put("Neptune", "60,182");
+
+ // Lambda with zero parameters using the Supplier functional interface
+ // from java.util.function.Supplier. The actual lambda expression is
+ // what comes after numPlanets =.
+ Supplier<String> numPlanets = () -> Integer.toString(planets.size());
+ System.out.format("Number of Planets: %s\n\n", numPlanets.get());
+
+ // Lambda with one parameter and using the Consumer functional interface
+ // from java.util.function.Consumer. This is because planets is a Map,
+ // which implements both Collection and Iterable. The forEach used here,
+ // found in Iterable, applies the lambda expression to each member of
+ // the Collection. The default implementation of forEach behaves as if:
+ /*
+ for (T t : this)
+ action.accept(t);
+ */
+
+ // The actual lambda expression is the parameter passed to forEach.
+ planets.keySet().forEach((p) -> System.out.format("%s\n", p));
+
+ // If you are only passing a single argument, then the above can also be
+ // written as (note absent parentheses around p):
+ planets.keySet().forEach(p -> System.out.format("%s\n", p));
+
+ // Tracing the above, we see that planets is a HashMap, keySet() returns
+ // a Set of its keys, forEach applies each element as the lambda
+ // expression of: (parameter p) -> System.out.format("%s\n", p). Each
+ // time, the element is said to be "consumed" and the statement(s)
+ // referred to in the lambda body is applied. Remember the lambda body
+ // is what comes after the ->.
+
+ // The above without use of lambdas would look more traditionally like:
+ for (String planet : planets.keySet()) {
+ System.out.format("%s\n", planet);
+ }
+
+ // This example differs from the above in that a different forEach
+ // implementation is used: the forEach found in the HashMap class
+ // implementing the Map interface. This forEach accepts a BiConsumer,
+ // which generically speaking is a fancy way of saying it handles
+ // the Set of each Key -> Value pairs. This default implementation
+ // behaves as if:
+ /*
+ for (Map.Entry<K, V> entry : map.entrySet())
+ action.accept(entry.getKey(), entry.getValue());
+ */
+
+ // The actual lambda expression is the parameter passed to forEach.
+ String orbits = "%s orbits the Sun in %s Earth days.\n";
+ planets.forEach((K, V) -> System.out.format(orbits, K, V));
+
+ // The above without use of lambdas would look more traditionally like:
+ for (String planet : planets.keySet()) {
+ System.out.format(orbits, planet, planets.get(planet));
+ }
+
+ // Or, if following more closely the specification provided by the
+ // default implementation:
+ for (Map.Entry<String, String> planet : planets.entrySet()) {
+ System.out.format(orbits, planet.getKey(), planet.getValue());
+ }
+
+ // These examples cover only the very basic use of lambdas. It might not
+ // seem like much or even very useful, but remember that a lambda can be
+ // created as an object that can later be passed as parameters to other
+ // methods.
+ }
+}
```
## Further Reading
diff --git a/javascript.html.markdown b/javascript.html.markdown
index 52084e93..ecaf02c5 100644
--- a/javascript.html.markdown
+++ b/javascript.html.markdown
@@ -266,6 +266,15 @@ for (var x in person){
description += person[x] + " ";
} // description = 'Paul Ken 18 '
+// The for/of statement allows iteration over iterable objects (including the built-in String,
+// Array, e.g. the Array-like arguments or NodeList objects, TypedArray, Map and Set,
+// and user-defined iterables).
+var myPets = "";
+var pets = ["cat", "dog", "hamster", "hedgehog"];
+for (var pet of pets){
+ myPets += pet + " ";
+} // myPets = 'cat dog hamster hedgehog '
+
// && is logical and, || is logical or
if (house.size == "big" && house.colour == "blue"){
house.contains = "bear";
diff --git a/lua.html.markdown b/lua.html.markdown
index 1e2d4366..32174a81 100644
--- a/lua.html.markdown
+++ b/lua.html.markdown
@@ -62,6 +62,11 @@ if not aBoolValue then print('twas false') end
-- in C/js:
ans = aBoolValue and 'yes' or 'no' --> 'no'
+-- BEWARE: this only acts as a ternary if the value returned when the condition
+-- evaluates to true is not `false` or Nil
+iAmNotFalse = (not aBoolValue) and false or true --> true
+iAmAlsoNotFalse = (not aBoolValue) and true or false --> true
+
karlSum = 0
for i = 1, 100 do -- The range includes both ends.
karlSum = karlSum + i
diff --git a/montilang.html.markdown b/montilang.html.markdown
new file mode 100644
index 00000000..cceb7aa1
--- /dev/null
+++ b/montilang.html.markdown
@@ -0,0 +1,233 @@
+---
+language: "montilang"
+filename: montilang.ml
+contributors:
+ - ["Leo Whitehead", "https://github.com/lduck11007"]
+---
+
+MontiLang is a Stack-Oriented concatenative imperative programming language. Its syntax
+is roughly based off of forth with similar style for doing arithmetic in [reverse polish notation.](https://en.wikipedia.org/wiki/Reverse_Polish_notation)
+
+A good way to start with MontiLang is to read the documentation and examples at [montilang.ml](http://montilang.ml),
+then download MontiLang or build from source code with the instructions provided.
+
+```
+/# Monti Reference sheet #/
+/#
+Comments are multiline
+Nested comments are not supported
+#/
+/# Whitespace is all arbitrary, indentation is optional #/
+/# All programming in Monti is done by manipulating the parameter stack
+arithmetic and stack operations in MontiLang are similar to FORTH
+https://en.wikipedia.org/wiki/Forth_(programming_language)
+#/
+
+/# in Monti, everything is either a string or a number. Operations treat all numbers
+similarly to floats, but anything without a remainder is treated as type int #/
+
+/# numbers and strings are added to the stack from left to right #/
+
+/# Arithmetic works by manipulating data on the stack #/
+
+5 3 + PRINT . /# 8 #/
+
+/# 5 and 3 are pushed onto the stack
+ '+' replaces top 2 items on stack with sum of top 2 items
+ 'PRINT' prints out the top item on the stack
+ '.' pops the top item from the stack.
+ #/
+
+6 7 * PRINT . /# 42 #/
+1360 23 - PRINT . /# 1337 #/
+12 12 / PRINT . /# 1 #/
+13 2 % PRINT . /# 1 #/
+
+37 NEG PRINT . /# -37 #/
+-12 ABS PRINT . /# 12 #/
+52 23 MAX PRINT . /# 52 #/
+52 23 MIN PRINT . /# 23 #/
+
+/# 'PSTACK' command prints the entire stack, 'CLEAR' clears the entire stack #/
+
+3 6 8 PSTACK CLEAR /# [3, 6, 8] #/
+
+/# Monti comes with some tools for stack manipulation #/
+
+2 DUP PSTACK CLEAR /# [2, 2] - Duplicate the top item on the stack#/
+2 6 SWAP PSTACK CLEAR /# [6, 2] - Swap top 2 items on stack #/
+1 2 3 ROT PSTACK CLEAR /# [2, 3, 1] - Rotate top 3 items on stack #/
+2 3 NIP PSTACK CLEAR /# [3] - delete second item from the top of the stack #/
+4 5 6 TRIM PSTACK CLEAR /# [5, 6] - Deletes first item on stack #/
+/# variables are assigned with the syntax 'VAR [name]'#/
+/# When assigned, the variable will take the value of the top item of the stack #/
+
+6 VAR six . /# assigns var 'six' to be equal to 6 #/
+3 6 + VAR a . /# assigns var 'a' to be equal to 9 #/
+
+/# the length of the stack can be calculated with the statement 'STKLEN' #/
+1 2 3 4 STKLEN PRINT CLEAR /# 4 #/
+
+/# strings are defined with | | #/
+
+|Hello World!| VAR world . /# sets variable 'world' equal to string 'Hello world! #/
+
+/# variables can be called by typing its name. when called, the value of the variable is pushed
+to the top of the stack #/
+world PRINT .
+
+/# with the OUT statement, the top item on the stack can be printed without a newline #/
+
+|world!| |Hello, | OUT SWAP PRINT CLEAR
+
+/# Data types can be converted between strings and integers with the commands 'TOINT' and 'TOSTR'#/
+|5| TOINT PSTACK . /# [5] #/
+45 TOSTR PSTACK . /# ['45'] #/
+
+/# User input is taken with INPUT and pushed to the stack. If the top item of the stack is a string,
+the string is used as an input prompt #/
+
+|What is your name? | INPUT NIP
+|Hello, | OUT SWAP PRINT CLEAR
+
+
+/# FOR loops have the syntax 'FOR [condition] [commands] ENDFOR' At the moment, [condition] can
+only have the value of an integer. Either by using an integer, or a variable call to an integer.
+[commands] will be interpereted the amount of time specified in [condition] #/
+/# E.G: this prints out 1 to 10 #/
+
+1 VAR a .
+FOR 10
+ a PRINT 1 + VAR a
+ENDFOR
+
+/# the syntax for while loops are similar. A number is evaluated as true if it is larger than
+0. a string is true if its length > 0. Infinite loops can be used by using literals.
+#/
+10 var loop .
+WHILE loop
+ loop print
+ 1 - var loop
+ENDWHILE
+/#
+this loop would count down from 10.
+
+IF statements are pretty much the same, but only are executed once.
+#/
+IF loop
+ loop PRINT .
+ENDIF
+
+/# This would only print 'loop' if it is larger than 0 #/
+
+/# If you would want to use the top item on the stack as loop parameters, this can be done with the ':' character #/
+
+/# eg, if you wanted to print 'hello' 7 times, instead of using #/
+
+FOR 7
+ |hello| PRINT .
+ENDFOR
+
+/# this could be used #/
+7
+FOR :
+ |hello| PRINT .
+ENDFOR
+
+/# Equality and inequality statements use the top 2 items on the stack as parameters, and replace the top two items with the output #/
+/# If it is true, the top 2 items are replaced with '1'. If false, with '0'. #/
+
+7 3 > PRINT . /# 1 #/
+2 10 > PRINT . /# 0 #/
+5 9 <= PRINT . /# 1 #/
+5 5 == PRINT . /# 1 #/
+5 7 == PRINT . /# 0 #/
+3 8 != PRINT . /# 1 #/
+
+/# User defined commands have the syntax of 'DEF [name] [commands] ENDDEF'. #/
+/# eg, if you wanted to define a function with the name of 'printseven' to print '7' 10 times, this could be used #/
+
+DEF printseven
+ FOR 10
+ 7 PRINT .
+ ENDFOR
+ENDDEF
+
+/# to run the defined statement, simply type it and it will be run by the interpereter #/
+
+printseven
+
+/# Montilang supports AND, OR and NOT statements #/
+
+1 0 AND PRINT . /# 0 #/
+1 1 AND PRINT . /# 1 #/
+1 0 OR PRINT . /# 1 #/
+0 0 OR PRINT . /# 0 #/
+1 NOT PRINT . /# 0 #/
+0 NOT PRINT . /# 1 #/
+
+/# Preprocessor statements are made inbetween '&' characters #/
+/# currently, preprocessor statements can be used to make c++-style constants #/
+
+&DEFINE LOOPSTR 20&
+/# must have & on either side with no spaces, 'DEFINE' is case sensative. #/
+/# All statements are scanned and replaced before the program is run, regardless of where the statements are placed #/
+
+FOR LOOPSTR 7 PRINT . ENDFOR /# Prints '7' 20 times. At run, 'LOOPSTR' in source code is replaced with '20' #/
+
+/# Multiple files can be used with the &INCLUDE <filename>& Command that operates similar to c++, where the file specified is tokenized,
+ and the &INCLUDE statement is replaced with the file #/
+
+/# E.G, you can have a program be run through several files. If you had the file 'name.mt' with the following data:
+
+[name.mt]
+|Hello, | OUT . name PRINT .
+
+a program that asks for your name and then prints it out can be defined as such: #/
+
+|What is your name? | INPUT VAR name . &INCLUDE name.mt&
+
+/# ARRAYS: #/
+
+/# arrays are defined with the statement 'ARR'
+When called, everything currently in the stack is put into one
+array and all items on the stack are replaced with the new array. #/
+
+2 3 4 ARR PSTACK . /# [[2, 3, 4]] #/
+
+/# the statement 'LEN' adds the length of the last item on the stack to the stack.
+This can be used on arrays, as well as strings. #/
+
+3 4 5 ARR LEN PRINT . /# 3 #/
+
+/# values can be appended to an array with the statement 'APPEND' #/
+
+1 2 3 ARR 5 APPEND . PRINT . /# [1, 2, 3, 5] #/
+
+/# an array at the top of the stack can be wiped with the statement 'WIPE' #/
+3 4 5 ARR WIPE PRINT . /# [] #/
+
+/# The last item of an array can be removed with the statement 'DROP' #/
+
+3 4 5 ARR DROP PRINT . /# [3, 4]
+/# arrays, like other datatypes can be stored in variables #/
+5 6 7 ARR VAR list .
+list PRINT . /# [5, 6, 7] #/
+
+/# Values at specific indexes can be changed with the statement 'INSERT <index>' #/
+4 5 6 ARR
+97 INSERT 1 . PRINT /# 4, 97, 6 #/
+
+/# Values at specific indexes can be deleted with the statement 'DEL <index>' #/
+1 2 3 ARR
+DEL 1 PRINT . /# [1, 3] #/
+
+/# items at certain indexes of an array can be gotten with the statement 'GET <index>' #/
+
+1 2 3 ARR GET 2 PSTACK /# [[1, 2, 3], 3] #/
+```
+
+## Extra information
+
+- [MontiLang.ml](http://montilang.ml/)
+- [Github Page](https://github.com/lduck11007/MontiLang)
diff --git a/moonscript.html.markdown b/moonscript.html.markdown
new file mode 100644
index 00000000..941578e7
--- /dev/null
+++ b/moonscript.html.markdown
@@ -0,0 +1,570 @@
+---
+language: moonscript
+contributors:
+ - ["RyanSquared", "https://ryansquared.github.io/"]
+ - ["Job van der Zwan", "https://github.com/JobLeonard"]
+filename: moonscript.moon
+---
+
+MoonScript is a dynamic scripting language that compiles into Lua. It gives
+you the power of one of the fastest scripting languages combined with a
+rich set of features.
+
+See [the MoonScript website](https://moonscript.org/) to see official guides on installation for all platforms.
+
+```moon
+-- Two dashes start a comment. Comments can go until the end of the line.
+-- MoonScript transpiled to Lua does not keep comments.
+
+-- As a note, MoonScript does not use 'do', 'then', or 'end' like Lua would and
+-- instead uses an indented syntax, much like Python.
+
+--------------------------------------------------
+-- 1. Assignment
+--------------------------------------------------
+
+hello = "world"
+a, b, c = 1, 2, 3
+hello = 123 -- Overwrites `hello` from above.
+
+x = 0
+x += 10 -- x = x + 10
+
+s = "hello "
+s ..= "world" -- s = s .. "world"
+
+b = false
+b and= true or false -- b = b and (true or false)
+
+--------------------------------------------------
+-- 2. Literals and Operators
+--------------------------------------------------
+
+-- Literals work almost exactly as they would in Lua. Strings can be broken in
+-- the middle of a line without requiring a \.
+
+some_string = "exa
+mple" -- local some_string = "exa\nmple"
+
+-- Strings can also have interpolated values, or values that are evaluated and
+-- then placed inside of a string.
+
+some_string = "This is an #{some_string}" -- Becomes 'This is an exa\nmple'
+
+--------------------------------------------------
+-- 2.1. Function Literals
+--------------------------------------------------
+
+-- Functions are written using arrows:
+
+my_function = -> -- compiles to `function() end`
+my_function() -- calls an empty function
+
+-- Functions can be called without using parenthesis. Parentheses may still be
+-- used to have priority over other functions.
+
+func_a = -> print "Hello World!"
+func_b = ->
+ value = 100
+ print "The value: #{value}"
+
+-- If a function needs no parameters, it can be called with either `()` or `!`.
+
+func_a!
+func_b()
+
+-- Functions can use arguments by preceding the arrow with a list of argument
+-- names bound by parentheses.
+
+sum = (x, y)-> x + y -- The last expression is returned from the function.
+print sum(5, 10)
+
+-- Lua has an idiom of sending the first argument to a function as the object,
+-- like a 'self' object. Using a fat arrow (=>) instead of a skinny arrow (->)
+-- automatically creates a `self` variable. `@x` is a shorthand for `self.x`.
+
+func = (num)=> @value + num
+
+-- Default arguments can also be used with function literals:
+
+a_function = (name = "something", height=100)->
+ print "Hello, I am #{name}.\nMy height is #{height}."
+
+-- Because default arguments are calculated in the body of the function when
+-- transpiled to Lua, you can reference previous arguments.
+
+some_args = (x = 100, y = x + 1000)-> print(x + y)
+
+--------------------------------------------------
+-- Considerations
+--------------------------------------------------
+
+-- The minus sign plays two roles, a unary negation operator and a binary
+-- subtraction operator. It is recommended to always use spaces between binary
+-- operators to avoid the possible collision.
+
+a = x - 10 -- a = x - 10
+b = x-10 -- b = x - 10
+c = x -y -- c = x(-y)
+d = x- z -- d = x - z
+
+-- When there is no space between a variable and string literal, the function
+-- call takes priority over following expressions:
+
+x = func"hello" + 100 -- func("hello") + 100
+y = func "hello" + 100 -- func("hello" + 100)
+
+-- Arguments to a function can span across multiple lines as long as the
+-- arguments are indented. The indentation can be nested as well.
+
+my_func 5, -- called as my_func(5, 8, another_func(6, 7, 9, 1, 2), 5, 4)
+ 8, another_func 6, 7, -- called as
+ 9, 1, 2, -- another_func(6, 7, 9, 1, 2)
+ 5, 4
+
+-- If a function is used at the start of a block, the indentation can be
+-- different than the level of indentation used in a block:
+
+if func 1, 2, 3, -- called as func(1, 2, 3, "hello", "world")
+ "hello",
+ "world"
+ print "hello"
+
+--------------------------------------------------
+-- 3. Tables
+--------------------------------------------------
+
+-- Tables are defined by curly braces, like Lua:
+
+some_values = {1, 2, 3, 4}
+
+-- Tables can use newlines instead of commas.
+
+some_other_values = {
+ 5, 6
+ 7, 8
+}
+
+-- Assignment is done with `:` instead of `=`:
+
+profile = {
+ name: "Bill"
+ age: 200
+ "favorite food": "rice"
+}
+
+-- Curly braces can be left off for `key: value` tables.
+
+y = type: "dog", legs: 4, tails: 1
+
+profile =
+ height: "4 feet",
+ shoe_size: 13,
+ favorite_foods: -- nested table
+ foo: "ice cream",
+ bar: "donuts"
+
+my_function dance: "Tango", partner: "none" -- :( forever alone
+
+-- Tables constructed from variables can use the same name as the variables
+-- by using `:` as a prefix operator.
+
+hair = "golden"
+height = 200
+person = {:hair, :height}
+
+-- Like in Lua, keys can be non-string or non-numeric values by using `[]`.
+
+t =
+ [1 + 2]: "hello"
+ "hello world": true -- Can use string literals without `[]`.
+
+--------------------------------------------------
+-- 3.1. Table Comprehensions
+--------------------------------------------------
+
+-- List Comprehensions
+
+-- Creates a copy of a list but with all items doubled. Using a star before a
+-- variable name or table can be used to iterate through the table's values.
+
+items = {1, 2, 3, 4}
+doubled = [item * 2 for item in *items]
+-- Uses `when` to determine if a value should be included.
+
+slice = [item for item in *items when i > 1 and i < 3]
+
+-- `for` clauses inside of list comprehensions can be chained.
+
+x_coords = {4, 5, 6, 7}
+y_coords = {9, 2, 3}
+
+points = [{x,y} for x in *x_coords for y in *y_coords]
+
+-- Numeric for loops can also be used in comprehensions:
+
+evens = [i for i=1, 100 when i % 2 == 0]
+
+-- Table Comprehensions are very similar but use `{` and `}` and take two
+-- values for each iteration.
+
+thing = color: "red", name: "thing", width: 123
+thing_copy = {k, v for k, v in pairs thing}
+
+-- Tables can be "flattened" from key-value pairs in an array by using `unpack`
+-- to return both values, using the first as the key and the second as the
+-- value.
+
+tuples = {{"hello", "world"}, {"foo", "bar"}}
+table = {unpack tuple for tuple in *tuples}
+
+-- Slicing can be done to iterate over only a certain section of an array. It
+-- uses the `*` notation for iterating but appends `[start, end, step]`.
+
+-- The next example also shows that this syntax can be used in a `for` loop as
+-- well as any comprehensions.
+
+for item in *points[1, 10, 2]
+ print unpack item
+
+-- Any undesired values can be left off. The second comma is not required if
+-- the step is not included.
+
+words = {"these", "are", "some", "words"}
+for word in *words[,3]
+ print word
+
+--------------------------------------------------
+-- 4. Control Structures
+--------------------------------------------------
+
+have_coins = false
+if have_coins
+ print "Got coins"
+else
+ print "No coins"
+
+-- Use `then` for single-line `if`
+if have_coins then "Got coins" else "No coins"
+
+-- `unless` is the opposite of `if`
+unless os.date("%A") == "Monday"
+ print "It is not Monday!"
+
+-- `if` and `unless` can be used as expressions
+is_tall = (name)-> if name == "Rob" then true else false
+message = "I am #{if is_tall "Rob" then "very tall" else "not so tall"}"
+print message -- "I am very tall"
+
+-- `if`, `elseif`, and `unless` can evaluate assignment as well as expressions.
+if x = possibly_nil! -- sets `x` to `possibly_nil()` and evaluates `x`
+ print x
+
+-- Conditionals can be used after a statement as well as before. This is
+-- called a "line decorator".
+
+is_monday = os.date("%A") == "Monday"
+print("It IS Monday!") if isMonday
+print("It is not Monday..") unless isMonday
+--print("It IS Monday!" if isMonday) -- Not a statement, does not work
+
+--------------------------------------------------
+-- 4.1 Loops
+--------------------------------------------------
+
+for i = 1, 10
+ print i
+
+for i = 10, 1, -1 do print i -- Use `do` for single-line loops.
+
+i = 0
+while i < 10
+ continue if i % 2 == 0 -- Continue statement; skip the rest of the loop.
+ print i
+
+-- Loops can be used as a line decorator, just like conditionals
+print "item: #{item}" for item in *items
+
+-- Using loops as an expression generates an array table. The last statement
+-- in the block is coerced into an expression and added to the table.
+my_numbers = for i = 1, 6 do i -- {1, 2, 3, 4, 5, 6}
+
+-- use `continue` to filter out values
+odds = for i in *my_numbers
+ continue if i % 2 == 0 -- acts opposite to `when` in comprehensions!
+ i -- Only added to return table if odd
+
+-- A `for` loop returns `nil` when it is the last statement of a function
+-- Use an explicit `return` to generate a table.
+print_squared = (t) -> for x in *t do x*x -- returns `nil`
+squared = (t) -> return for x in *t do x*x -- returns new table of squares
+
+-- The following does the same as `(t) -> [i for i in *t when i % 2 == 0]`
+-- But list comprehension generates better code and is more readable!
+
+filter_odds = (t) ->
+ return for x in *t
+ if x % 2 == 0 then x else continue
+evens = filter_odds(my_numbers) -- {2, 4, 6}
+
+--------------------------------------------------
+-- 4.2 Switch Statements
+--------------------------------------------------
+
+-- Switch statements are a shorthand way of writing multiple `if` statements
+-- checking against the same value. The value is only evaluated once.
+
+name = "Dan"
+
+switch name
+ when "Dave"
+ print "You are Dave."
+ when "Dan"
+ print "You are not Dave, but Dan."
+ else
+ print "You are neither Dave nor Dan."
+
+-- Switches can also be used as expressions, as well as compare multiple
+-- values. The values can be on the same line as the `when` clause if they
+-- are only one expression.
+
+b = 4
+next_even = switch b
+ when 1 then 2
+ when 2, 3 then 4
+ when 4, 5 then 6
+ else error "I can't count that high! D:"
+
+--------------------------------------------------
+-- 5. Object Oriented Programming
+--------------------------------------------------
+
+-- Classes are created using the `class` keyword followed by an identifier,
+-- typically written using CamelCase. Values specific to a class can use @ as
+-- the identifier instead of `self.value`.
+
+class Inventory
+ new: => @items = {}
+ add_item: (name)=> -- note the use of fat arrow for classes!
+ @items[name] = 0 unless @items[name]
+ @items[name] += 1
+
+-- The `new` function inside of a class is special because it is called when
+-- an instance of the class is created.
+
+-- Creating an instance of the class is as simple as calling the class as a
+-- function. Calling functions inside of the class uses \ to separate the
+-- instance from the function it is calling.
+
+inv = Inventory!
+inv\add_item "t-shirt"
+inv\add_item "pants"
+
+-- Values defined in the class - not the new() function - will be shared across
+-- all instances of the class.
+
+class Person
+ clothes: {}
+ give_item: (name)=>
+ table.insert @clothes name
+
+a = Person!
+b = Person!
+
+a\give_item "pants"
+b\give_item "shirt"
+
+-- prints out both "pants" and "shirt"
+
+print item for item in *a.clothes
+
+-- Class instances have a value `.__class` that are equal to the class object
+-- that created the instance.
+
+assert(b.__class == Person)
+
+-- Variables declared in class body the using the `=` operator are locals,
+-- so these "private" variables are only accessible within the current scope.
+
+class SomeClass
+ x = 0
+ reveal: ->
+ x += 1
+ print x
+
+a = SomeClass!
+b = SomeClass!
+print a.x -- nil
+a.reveal! -- 1
+b.reveal! -- 2
+
+--------------------------------------------------
+-- 5.1 Inheritance
+--------------------------------------------------
+
+-- The `extends` keyword can be used to inherit properties and methods from
+-- another class.
+
+class Backpack extends Inventory
+ size: 10
+ add_item: (name)=>
+ error "backpack is full" if #@items > @size
+ super name -- calls Inventory.add_item with `name`.
+
+-- Because a `new` method was not added, the `new` method from `Inventory` will
+-- be used instead. If we did want to use a constructor while still using the
+-- constructor from `Inventory`, we could use the magical `super` function
+-- during `new()`.
+
+-- When a class extends another, it calls the method `__inherited` on the
+-- parent class (if it exists). It is always called with the parent and the
+-- child object.
+
+class ParentClass
+ @__inherited: (child)=>
+ print "#{@__name} was inherited by #{child.__name}"
+ a_method: (a, b) => print a .. ' ' .. b
+
+-- Will print 'ParentClass was inherited by MyClass'
+
+class MyClass extends ParentClass
+ a_method: =>
+ super "hello world", "from MyClass!"
+ assert super == ParentClass
+
+--------------------------------------------------
+-- 6. Scope
+--------------------------------------------------
+
+-- All values are local by default. The `export` keyword can be used to
+-- declare the variable as a global value.
+
+export var_1, var_2
+var_1, var_3 = "hello", "world" -- var_3 is local, var_1 is not.
+
+export this_is_global_assignment = "Hi!"
+
+-- Classes can also be prefixed with `export` to make them global classes.
+-- Alternatively, all CamelCase variables can be exported automatically using
+-- `export ^`, and all values can be exported using `export *`.
+
+-- `do` lets you manually create a scope, for when you need local variables.
+
+do
+ x = 5
+print x -- nil
+
+-- Here we use `do` as an expression to create a closure.
+
+counter = do
+ i = 0
+ ->
+ i += 1
+ return i
+
+print counter! -- 1
+print counter! -- 2
+
+-- The `local` keyword can be used to define variables
+-- before they are assigned.
+
+local var_4
+if something
+ var_4 = 1
+print var_4 -- works because `var_4` was set in this scope, not the `if` scope.
+
+-- The `local` keyword can also be used to shadow an existing variable.
+
+x = 10
+if false
+ local x
+ x = 12
+print x -- 10
+
+-- Use `local *` to forward-declare all variables.
+-- Alternatively, use `local ^` to forward-declare all CamelCase values.
+
+local *
+
+first = ->
+ second!
+
+second = ->
+ print data
+
+data = {}
+
+--------------------------------------------------
+-- 6.1 Import
+--------------------------------------------------
+
+-- Values from a table can be brought to the current scope using the `import`
+-- and `from` keyword. Names in the `import` list can be preceded by `\` if
+-- they are a module function.
+
+import insert from table -- local insert = table.insert
+import \add from state: 100, add: (value)=> @state + value
+print add 22
+
+-- Like tables, commas can be excluded from `import` lists to allow for longer
+-- lists of imported items.
+
+import
+ asdf, gh, jkl
+ antidisestablishmentarianism
+ from {}
+
+--------------------------------------------------
+-- 6.2 With
+--------------------------------------------------
+
+-- The `with` statement can be used to quickly call and assign values in an
+-- instance of a class or object.
+
+file = with File "lmsi15m.moon" -- `file` is the value of `set_encoding()`.
+ \set_encoding "utf8"
+
+create_person = (name, relatives)->
+ with Person!
+ .name = name
+ \add_relative relative for relative in *relatives
+me = create_person "Ryan", {"sister", "sister", "brother", "dad", "mother"}
+
+with str = "Hello" -- assignment as expression! :D
+ print "original: #{str}"
+ print "upper: #{\upper!}"
+
+--------------------------------------------------
+-- 6.3 Destructuring
+--------------------------------------------------
+
+-- Destructuring can take arrays, tables, and nested tables and convert them
+-- into local variables.
+
+obj2 =
+ numbers: {1, 2, 3, 4}
+ properties:
+ color: "green"
+ height: 13.5
+
+{numbers: {first, second}, properties: {:color}} = obj2
+
+print first, second, color -- 1 2 green
+
+-- `first` and `second` return [1] and [2] because they are as an array, but
+-- `:color` is like `color: color` so it sets itself to the `color` value.
+
+-- Destructuring can be used in place of `import`.
+
+{:max, :min, random: rand} = math -- rename math.random to rand
+
+-- Destructuring can be done anywhere assignment can be done.
+
+for {left, right} in *{{"hello", "world"}, {"egg", "head"}}
+ print left, right
+```
+
+## Additional Resources
+
+- [Language Guide](https://moonscript.org/reference/)
+- [Online Compiler](https://moonscript.org/compiler/)
diff --git a/pt-br/solidity-pt.html.markdown b/pt-br/solidity-pt.html.markdown
index 37d15bf2..d4555fa7 100644
--- a/pt-br/solidity-pt.html.markdown
+++ b/pt-br/solidity-pt.html.markdown
@@ -1,6 +1,6 @@
---
language: Solidity
-filename: learnSolidity.sol
+filename: learnSolidity-br.sol
contributors:
- ["Nemil Dalal", "https://www.nemil.com"]
- ["Joseph Chow", ""]
diff --git a/pythonstatcomp.html.markdown b/pythonstatcomp.html.markdown
index 6dde1cf0..2440d859 100644
--- a/pythonstatcomp.html.markdown
+++ b/pythonstatcomp.html.markdown
@@ -38,18 +38,16 @@ r.text # raw page source
print(r.text) # prettily formatted
# save the page source in a file:
os.getcwd() # check what's the working directory
-f = open("learnxinyminutes.html", "wb")
-f.write(r.text.encode("UTF-8"))
-f.close()
+with open("learnxinyminutes.html", "wb") as f:
+ f.write(r.text.encode("UTF-8"))
# downloading a csv
fp = "https://raw.githubusercontent.com/adambard/learnxinyminutes-docs/master/"
fn = "pets.csv"
r = requests.get(fp + fn)
print(r.text)
-f = open(fn, "wb")
-f.write(r.text.encode("UTF-8"))
-f.close()
+with open(fn, "wb") as f:
+ f.write(r.text.encode("UTF-8"))
""" for more on the requests module, including APIs, see
http://docs.python-requests.org/en/latest/user/quickstart/
@@ -71,8 +69,8 @@ pets
# 1 vesuvius 6 23 fish
# 2 rex 5 34 dog
-""" R users: note that Python, like most normal programming languages, starts
- indexing from 0. R is the unusual one for starting from 1.
+""" R users: note that Python, like most C-influenced programming languages, starts
+ indexing from 0. R starts indexing at 1 due to Fortran influence.
"""
# two different ways to print out a column
@@ -205,7 +203,7 @@ hre["DeathY"] = extractYear(hre.Death)
hre["EstAge"] = hre.DeathY.astype(int) - hre.BirthY.astype(int)
# simple scatterplot, no trend line, color represents dynasty
-sns.lmplot("BirthY", "EstAge", data=hre, hue="Dynasty", fit_reg=False);
+sns.lmplot("BirthY", "EstAge", data=hre, hue="Dynasty", fit_reg=False)
# use scipy to run a linear regression
from scipy import stats
@@ -222,7 +220,7 @@ rval**2 # 0.020363950027333586
pval # 0.34971812581498452
# use seaborn to make a scatterplot and plot the linear regression trend line
-sns.lmplot("BirthY", "EstAge", data=hre);
+sns.lmplot("BirthY", "EstAge", data=hre)
""" For more information on seaborn, see
- http://web.stanford.edu/~mwaskom/software/seaborn/
diff --git a/ro-ro/elixir-ro.html.markdown b/ro-ro/elixir-ro.html.markdown
index d8b261af..10fec3c5 100644
--- a/ro-ro/elixir-ro.html.markdown
+++ b/ro-ro/elixir-ro.html.markdown
@@ -7,7 +7,7 @@ contributors:
- ["Ev Bogdanov", "https://github.com/evbogdanov"]
translators:
- ["Vitalie Lazu", "https://github.com/vitaliel"]
-
+lang: ro-ro
filename: learnelixir-ro.ex
---
diff --git a/ru-ru/jquery-ru.html.markdown b/ru-ru/jquery-ru.html.markdown
new file mode 100644
index 00000000..471b4e24
--- /dev/null
+++ b/ru-ru/jquery-ru.html.markdown
@@ -0,0 +1,127 @@
+---
+category: tool
+tool: jquery
+contributors:
+ - ["Sawyer Charles", "https://github.com/xssc"]
+translators:
+ - ["Ev Bogdanov", "https://github.com/evbogdanov"]
+lang: ru-ru
+filename: jquery-ru.js
+---
+
+jQuery — это библиотека JavaScript, которая помогает "делать больше, писать меньше". Она выполняет множество типичных JavaScript-задач, упрощая написание кода. jQuery используется крупными компаниями и разработчиками со всего мира. Она упрощает и ускоряет работу с AJAX, с событиями, с DOM и со многим другим.
+
+Поскольку jQuery является библиотекой JavaScript, вам следует начать с [изучения JavaScript](https://learnxinyminutes.com/docs/ru-ru/javascript-ru/).
+
+```js
+
+
+///////////////////////////////////
+// 1. Селекторы
+
+// Для получения элемента в jQuery используются селекторы
+var page = $(window); // Получить страницу целиком
+
+// В качестве селектора может выступать CSS-селектор
+var paragraph = $('p'); // Получить все <p> элементы
+var table1 = $('#table1'); // Получить элемент с идентификатором 'table1'
+var squares = $('.square'); // Получить все элементы с классом 'square'
+var square_p = $('p.square') // Получить <p> элементы с классом 'square'
+
+
+///////////////////////////////////
+// 2. События и эффекты
+// jQuery прекрасно справляется с обработкой событий
+// Часто используемое событие — это событие документа 'ready'
+// Вы можете использовать метод 'ready', который сработает, как только документ полностью загрузится
+$(document).ready(function(){
+ // Код не выполнится до тех пор, пока документ не будет загружен
+});
+// Обработку события можно вынести в отдельную функцию
+function onAction() {
+ // Код выполнится, когда произойдёт событие
+}
+$('#btn').click(onAction); // Обработчик события сработает при клике
+
+// Другие распространённые события:
+$('#btn').dblclick(onAction); // Двойной клик
+$('#btn').hover(onAction); // Наведение курсора
+$('#btn').focus(onAction); // Фокус
+$('#btn').blur(onAction); // Потеря фокуса
+$('#btn').submit(onAction); // Отправка формы
+$('#btn').select(onAction); // Когда выбрали элемент
+$('#btn').keydown(onAction); // Когда нажали клавишу
+$('#btn').keyup(onAction); // Когда отпустили клавишу
+$('#btn').keypress(onAction); // Когда нажали символьную клавишу (нажатие привело к появлению символа)
+$('#btn').mousemove(onAction); // Когда переместили курсор мыши
+$('#btn').mouseenter(onAction); // Когда навели курсор на элемент
+$('#btn').mouseleave(onAction); // Когда сдвинули курсор с элемента
+
+
+// Вы можете не только обрабатывать события, но и вызывать их
+$('#btn').dblclick(); // Вызвать двойной клик на элементе
+
+// Для одного селектора возможно назначить несколько обработчиков событий
+$('#btn').on(
+ {dblclick: myFunction1} // Обработать двойной клик
+ {blur: myFunction1} // Обработать исчезновение фокуса
+);
+
+// Вы можете перемещать и прятать элементы с помощью методов-эффектов
+$('.table').hide(); // Спрятать элемент(ы)
+
+// Обратите внимание: вызов функции в этих методах всё равно спрячет сам элемент
+$('.table').hide(function(){
+ // Сначала спрятать элемент, затем вызвать функцию
+});
+
+// Вы можете хранить селекторы в переменных
+var tables = $('.table');
+
+// Некоторые основные методы для манипуляций с документом:
+tables.hide(); // Спрятать элемент(ы)
+tables.show(); // Показать элемент(ы)
+tables.toggle(); // Спрятать/показать
+tables.fadeOut(); // Плавное исчезновение
+tables.fadeIn(); // Плавное появление
+tables.fadeToggle(); // Плавное исчезновение или появление
+tables.fadeTo(0.5); // Изменение прозрачности
+tables.slideUp(); // Свернуть элемент
+tables.slideDown(); // Развернуть элемент
+tables.slideToggle(); // Свернуть или развернуть
+
+// Все эти методы принимают скорость (в миллисекундах) и функцию обратного вызова
+tables.hide(1000, myFunction); // Анимация длится 1 секунду, затем вызов функции
+
+// В методе 'fadeTo' вторым параметром обязательно идёт прозрачность
+tables.fadeTo(2000, 0.1, myFunction); // Прозрачность меняется в течение 2 секунд до 0.1, затем вызывается функция
+
+// Метод 'animate' позволяет делать более продвинутую анимацию
+tables.animate({"margin-top": "+=50", height: "100px"}, 500, myFunction);
+
+
+///////////////////////////////////
+// 3. Манипуляции
+
+// Манипуляции похожи на эффекты, но позволяют добиться большего
+$('div').addClass('taming-slim-20'); // Добавить класс 'taming-slim-20' ко всем <div> элементам
+
+// Часто встречающиеся методы манипуляций
+$('p').append('Hello world'); // Добавить в конец элемента
+$('p').attr('class'); // Получить атрибут
+$('p').attr('class', 'content'); // Установить атрибут
+$('p').hasClass('taming-slim-20'); // Проверить наличие класса
+$('p').height(); // Получить или установить высоту элемента
+
+
+// Во многих методах вам доступна информация ТОЛЬКО о первом элементе из выбранных
+$('p').height(); // Вы получите высоту только для первого <p> элемента
+
+// Метод 'each' позволяет это исправить и пройтись по всем выбранным вами элементам
+var heights = [];
+$('p').each(function() {
+ heights.push($(this).height()); // Добавить высоту всех <p> элементов в массив
+});
+
+
+```
diff --git a/ru-ru/markdown-ru.html.markdown b/ru-ru/markdown-ru.html.markdown
index 91f53f54..579a9a20 100644
--- a/ru-ru/markdown-ru.html.markdown
+++ b/ru-ru/markdown-ru.html.markdown
@@ -43,6 +43,7 @@ Markdown является надмножеством HTML, поэтому люб
и попадают в итоговый HTML без изменений. Однако следует понимать,
что эта же особенность не позволяет использовать разметку Markdown внутри
HTML-элементов -->
+```
## Заголовки
diff --git a/ruby-ecosystem.html.markdown b/ruby-ecosystem.html.markdown
index 50eedcd0..3c80075b 100644
--- a/ruby-ecosystem.html.markdown
+++ b/ruby-ecosystem.html.markdown
@@ -10,6 +10,16 @@ contributors:
People using Ruby generally have a way to install different Ruby versions,
manage their packages (or gems), and manage their gem dependencies.
+## Ruby Versions
+
+Ruby was created by Yukihiro "Matz" Matsumoto, who remains somewhat of a
+[BDFL](https://en.wikipedia.org/wiki/Benevolent_Dictator_for_Life), although
+that is changing recently. As a result, the reference implementation of Ruby is
+called MRI (Matz' Reference Implementation), and when you hear a Ruby version,
+it is referring to the release version of MRI.
+
+New major versions of Ruby are traditionally released on Christmas Day. The current major version (25 December 2017) is 2.5. The most popular stable versions are 2.4.4 and 2.3.7 (both released 28 March 2018).
+
## Ruby Managers
Some platforms have Ruby pre-installed or available as a package. Most rubyists
@@ -29,28 +39,6 @@ The following are the popular Ruby environment managers:
* [chruby](https://github.com/postmodern/chruby) - Only switches between rubies.
Similar in spirit to rbenv. Unopinionated about how rubies are installed.
-## Ruby Versions
-
-Ruby was created by Yukihiro "Matz" Matsumoto, who remains somewhat of a
-[BDFL](https://en.wikipedia.org/wiki/Benevolent_Dictator_for_Life), although
-that is changing recently. As a result, the reference implementation of Ruby is
-called MRI (Matz' Reference Implementation), and when you hear a Ruby version,
-it is referring to the release version of MRI.
-
-The three major version of Ruby in use are:
-
-* 2.0.0 - Released in February 2013. Most major libraries and frameworks support
- 2.0.0.
-* 1.9.3 - Released in October 2011. This is the version most rubyists use
- currently. Also [retired](https://www.ruby-lang.org/en/news/2015/02/23/support-for-ruby-1-9-3-has-ended/)
-* 1.8.7 - Ruby 1.8.7 has been
- [retired](http://www.ruby-lang.org/en/news/2013/06/30/we-retire-1-8-7/).
-
-The change between 1.8.7 to 1.9.x is a much larger change than 1.9.3 to 2.0.0.
-For instance, the 1.9 series introduced encodings and a bytecode VM. There
-are projects still on 1.8.7, but they are becoming a small minority, as most of
-the community has moved to at least 1.9.2 or 1.9.3.
-
## Ruby Implementations
The Ruby ecosystem enjoys many different implementations of Ruby, each with
diff --git a/scala.html.markdown b/scala.html.markdown
index 016e2b4f..28424684 100644
--- a/scala.html.markdown
+++ b/scala.html.markdown
@@ -716,7 +716,7 @@ import scala.collection.immutable.{Map => _, Set => _, _}
// Java classes can also be imported. Scala syntax can be used
import java.swing.{JFrame, JWindow}
-// Your programs entry point is defined in an scala file using an object, with a
+// Your programs entry point is defined in a scala file using an object, with a
// single method, main:
object Application {
def main(args: Array[String]): Unit = {
diff --git a/solidity.html.markdown b/solidity.html.markdown
index b657b6a1..004c225e 100644
--- a/solidity.html.markdown
+++ b/solidity.html.markdown
@@ -829,7 +829,6 @@ someContractAddress.callcode('function_name');
## Additional resources
- [Solidity Docs](https://solidity.readthedocs.org/en/latest/)
- [Smart Contract Best Practices](https://github.com/ConsenSys/smart-contract-best-practices)
-- [Solidity Style Guide](https://ethereum.github.io/solidity//docs/style-guide/): Ethereum's style guide is heavily derived from Python's [pep8](https://www.python.org/dev/peps/pep-0008/) style guide.
- [EthFiddle - The JsFiddle for Solidity](https://ethfiddle.com/)
- [Browser-based Solidity Editor](https://remix.ethereum.org/)
- [Gitter Solidity Chat room](https://gitter.im/ethereum/solidity)
@@ -850,9 +849,10 @@ someContractAddress.callcode('function_name');
- [Hacking Distributed Blog](http://hackingdistributed.com/)
## Style
-- Python's [PEP8](https://www.python.org/dev/peps/pep-0008/) is used as the baseline style guide, including its general philosophy
+- [Solidity Style Guide](http://solidity.readthedocs.io/en/latest/style-guide.html): Ethereum's style guide is heavily derived from Python's [PEP 8](https://www.python.org/dev/peps/pep-0008/) style guide.
## Editors
+- [Emacs Solidity Mode](https://github.com/ethereum/emacs-solidity)
- [Vim Solidity](https://github.com/tomlion/vim-solidity)
- Editor Snippets ([Ultisnips format](https://gist.github.com/nemild/98343ce6b16b747788bc))
diff --git a/tests/encoding.rb b/tests/encoding.rb
new file mode 100644
index 00000000..a0b3b184
--- /dev/null
+++ b/tests/encoding.rb
@@ -0,0 +1,32 @@
+#!/usr/bin/env ruby
+require 'charlock_holmes'
+$file_count = 0;
+markdown_files = Dir["./**/*.html.markdown"]
+markdown_files.each do |file|
+ begin
+ contents = File.read(file)
+ detection = CharlockHolmes::EncodingDetector.detect(contents)
+ case detection[:encoding]
+ when 'UTF-8'
+ $file_count = $file_count + 1
+ when 'ISO-8859-1'
+ $file_count = $file_count + 1
+ when /ISO-8859/
+ puts "Notice: #{file} was detected as #{detection[:encoding]} encoding. Everything is probably fine."
+ $file_count = $file_count + 1
+ else
+ puts "WARNING #{file} was detected as #{detection[:encoding]} encoding. Please save the file in UTF-8!"
+ end
+ rescue Exception => msg
+ puts msg
+ end
+end
+files_failed = markdown_files.length - $file_count
+if files_failed != 0
+ puts "FAILURE!!! #{files_failed} files were unable to be validated as UTF-8!"
+ puts "Please resave the file as UTF-8."
+ exit 1
+else
+ puts "Success. All #{$file_count} files passed UTF-8 validity checks."
+ exit 0
+end
diff --git a/tests/yaml.rb b/tests/yaml.rb
new file mode 100644
index 00000000..0ed918e0
--- /dev/null
+++ b/tests/yaml.rb
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+require 'yaml';
+$file_count = 0;
+markdown_files = Dir["./**/*.html.markdown"]
+markdown_files.each do |file|
+ begin
+ YAML.load_file(file)
+ $file_count = $file_count + 1
+ rescue Exception => msg
+ puts msg
+ end
+end
+files_failed = markdown_files.length - $file_count
+if files_failed != 0
+ puts "FAILURE!!! #{files_failed} files were unable to be parsed!"
+ puts "Please check the YAML headers for the documents that failed!"
+ exit 1
+else
+ puts "All #{$file_count} files were verified valid YAML"
+ exit 0
+end
diff --git a/tr-tr/c++-tr.html.markdown b/tr-tr/c++-tr.html.markdown
index 8ac6ef8b..2c841456 100644
--- a/tr-tr/c++-tr.html.markdown
+++ b/tr-tr/c++-tr.html.markdown
@@ -1,7 +1,7 @@
---
language: c++
lang: tr-tr
-filename: learncpp.cpp
+filename: learncpp-tr.cpp
contributors:
- ["Steven Basart", "http://github.com/xksteven"]
- ["Matt Kline", "https://github.com/mrkline"]
diff --git a/tr-tr/git-tr.html.markdown b/tr-tr/git-tr.html.markdown
index 72197050..87c1820c 100644
--- a/tr-tr/git-tr.html.markdown
+++ b/tr-tr/git-tr.html.markdown
@@ -12,7 +12,7 @@ contributors:
- ["Milo Gilad", "http://github.com/Myl0g"]
- ["Adem Budak", "https://github.com/p1v0t"]
-filename: LearnGit.txt
+filename: LearnGit-tr.txt
---
Git dağınık versiyon kontrol ve kaynak kod yönetim sistemidir.