COFFEESCRIPT
           счастье для javascript разработчика




Иван Немытченко                        Омск, 26 июня 2010
JAVASCRIPT
var a = "3";
2+a-a-2 ==
var a = "3";
2+a-a-2 == 18
'' == '0'   // false
0 == ''     // true
0 == '0'    // true
'' == '0'          // false
0 == ''            // true
0 == '0'           // true

false == 'false'   // false
false == '0...
'' == '0'          // false
0 == ''            // true
0 == '0'           // true

false == 'false'   // false
false == '0...
'' == '0'          // false
0 == ''            // true
0 == '0'           // true

false == 'false'   // false
false == '0...
typeof(1)       // "number"
typeof('a')     // "string"
typeof({a:1})   // "object"
typeof(1)       // "number"
typeof('a')     // "string"
typeof({a:1})   // "object"

typeof([1,2])   // "object"
typeof(nu...
typeof(1)                    // "number"
typeof('a')                  // "string"
typeof({a:1})                // "object"...
if(a == b)
  c = 3;
if(a == b)
  c = 3;
  doSomething();
if(a == b)
  c = 3;
  doSomething();

if(a == b){
  c = 3;
  doSomething();
}
if(a == b)
  c = 3;
  doSomething();

if(a == b){
  c = 3;
}
doSomething();
глобальные переменные
точка с запятой
                    прототипное
                    наследование
             with
 ...
JAVASCRIPT

ПЛОХОЙ КОД
ЛЕГКО ПИСАТЬ
JAVASCRIPT

ХОРОШИЙ КОД
СЛОЖНО ПИСАТЬ
JAVASCRIPT

ХОРОШИЙ КОД
СЛОЖНО ЧИТАТЬ
JAVASCRIPT
var _a, _b, age, ages, child;
var __hasProp = Object.prototype.hasOwnProperty;

ages = (function() {
  _a = [];...
COFFEESCRIPT

  INSPIRED BY
COFFEESCRIPT

  INSPIRED BY
COFFEESCRIPT

  INSPIRED BY
Все является выражением
Условия
Условия
Функции
Объекты
Произвольное кол-во параметров


race: (winner, runners...) ->
  print winner, runners
Проверка на существование


alert "Yay!" if margincon?


               if ((typeof margincon !== "undefined"
            ...
Интервалы (ranges)

numbers: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

three_to_six: numbers[3..6]

numbers_copy: numbers[0...number...
Проход по массиву (итерации)

cubed_list: math.cube num for num in list

countdown: num for num in [10..1]
Проход по хэшу (свойствам объекта)


  years_old: {max: 10, ida: 9, tim: 11}

  ages: for child, age of years_old
    chil...
Присвоение по паттерну


bait: 1000
and_switch: 0

[bait, and_switch]: [and_switch, bait]
Строки
moby_dick: "Lorem ipsum dolor   var moby_dick;
sit amet, consectetur           moby_dick = "Lorem ipsum dolor   
ad...
Наследование
Наследование


    Base2
 PrototypeJS
   JS.Class
brain-safe way
       Наследование
class Animal
  move: (meters) ->
    alert @name + " moved " + meters + "m."

class Sna...
Собери всю коллекцию!


        HTML
         CSS
     JAVASCRIPT
HTML
<article id='id1'>
  <section class='a1'>
    Lorem ipsum
  </section>
  <section class='a2'>
    Sit dolor
  </secti...
HTML → HAML

 %article#id1
   %section.a1
     Lorem ipsum
   %section.a2
     Sit dolor
CSS
article {
  margin: 2em 0;
}
article section {
  text-align: right;
}
CSS → SASS

article
  margin: 2em 0
  section
    text-align: right
JAVASCRIPT
var margincon;
margincon = {
   date: "26.06.2010"
};

if ((typeof margincon !== "undefined"
     && margincon ...
JAVASCRIPT → COFFEESCRIPT



  margincon: {date: "26.06.2010"}
  alert "Yay!" if margincon?
HTML → HAML
         CSS → SASS
JAVASCRIPT → COFFEESCRIPT
HTML → HAML
         CSS → SASS
JAVASCRIPT → COFFEESCRIPT

     JSON → TEQUILA
COFFEESCRIPT



.coffee → .js
COFFEESCRIPT
COFFEESCRIPT
УСТАНОВКА
                Node.js
http://github.com/jashkenas/coffee-script

          sudo bin/cake install
УСТАНОВКА
                Node.js
http://github.com/jashkenas/coffee-script

          sudo bin/cake install



       bre...
УСТАНОВКА
...
<script type="text/coffeescript">
  alert "Inline scripting!"
</script>
...
thnx to @drnic
http://coffeescript.org




  http://jazzcloud.net
http://twitter.com/inem
Coffescript - счастье для javascript-разработчика
Upcoming SlideShare
Loading in …5
×

Coffescript - счастье для javascript-разработчика

5,524 views
5,445 views

Published on

Published in: Technology, Design
3 Comments
7 Likes
Statistics
Notes
No Downloads
Views
Total views
5,524
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
53
Comments
3
Likes
7
Embeds 0
No embeds

No notes for slide
  • &amp;#x414;&amp;#x43E;&amp;#x431;&amp;#x440;&amp;#x43E;&amp;#x435; &amp;#x443;&amp;#x442;&amp;#x440;&amp;#x43E;. &amp;#x41C;&amp;#x435;&amp;#x43D;&amp;#x44F; &amp;#x437;&amp;#x43E;&amp;#x432;&amp;#x443;&amp;#x442; &amp;#x418;&amp;#x432;&amp;#x430;&amp;#x43D; &amp;#x41D;&amp;#x435;&amp;#x43C;&amp;#x44B;&amp;#x442;&amp;#x447;&amp;#x435;&amp;#x43D;&amp;#x43A;&amp;#x43E;. &amp;#x42F; - &amp;#x434;&amp;#x438;&amp;#x440;&amp;#x435;&amp;#x43A;&amp;#x442;&amp;#x43E;&amp;#x440; &amp;#x43A;&amp;#x43E;&amp;#x43C;&amp;#x43F;&amp;#x430;&amp;#x43D;&amp;#x438;&amp;#x438; &amp;#x414;&amp;#x436;&amp;#x430;&amp;#x437;&amp;#x41A;&amp;#x43B;&amp;#x430;&amp;#x443;&amp;#x434;. &amp;#x420;&amp;#x430;&amp;#x434; &amp;#x437;&amp;#x434;&amp;#x435;&amp;#x441;&amp;#x44C; &amp;#x432;&amp;#x441;&amp;#x435;&amp;#x445; &amp;#x432;&amp;#x430;&amp;#x441; &amp;#x432;&amp;#x438;&amp;#x434;&amp;#x435;&amp;#x442;&amp;#x44C;. &amp;#x421;&amp;#x43F;&amp;#x430;&amp;#x441;&amp;#x438;&amp;#x431;&amp;#x43E; &amp;#x42E;&amp;#x440;&amp;#x435; &amp;#x437;&amp;#x430; &amp;#x442;&amp;#x43E; &amp;#x447;&amp;#x442;&amp;#x43E; &amp;#x440;&amp;#x430;&amp;#x434;&amp;#x443;&amp;#x435;&amp;#x442; &amp;#x43D;&amp;#x430;&amp;#x441; &amp;#x432;&amp;#x441;&amp;#x435; &amp;#x431;&amp;#x43E;&amp;#x43B;&amp;#x435;&amp;#x435; &amp;#x438;&amp;#x43D;&amp;#x442;&amp;#x435;&amp;#x440;&amp;#x435;&amp;#x441;&amp;#x43D;&amp;#x44B;&amp;#x43C;&amp;#x438; &amp;#x43A;&amp;#x43E;&amp;#x43D;&amp;#x444;&amp;#x435;&amp;#x440;&amp;#x435;&amp;#x43D;&amp;#x446;&amp;#x438;&amp;#x44F;&amp;#x43C;&amp;#x438;. &amp;#x41D;&amp;#x430;&amp;#x448;&amp;#x435;&amp;#x439; &amp;#x43A;&amp;#x43E;&amp;#x43C;&amp;#x43F;&amp;#x430;&amp;#x43D;&amp;#x438;&amp;#x438; &amp;#x432; &amp;#x44D;&amp;#x442;&amp;#x43E;&amp;#x43C; &amp;#x433;&amp;#x43E;&amp;#x434;&amp;#x443; &amp;#x443;&amp;#x434;&amp;#x430;&amp;#x43B;&amp;#x43E;&amp;#x441;&amp;#x44C; &amp;#x43F;&amp;#x43E;&amp;#x43C;&amp;#x43E;&amp;#x447;&amp;#x44C; &amp;#x444;&amp;#x438;&amp;#x43D;&amp;#x430;&amp;#x43D;&amp;#x441;&amp;#x43E;&amp;#x432;&amp;#x43E; &amp;#x432; &amp;#x43F;&amp;#x440;&amp;#x43E;&amp;#x432;&amp;#x435;&amp;#x434;&amp;#x435;&amp;#x43D;&amp;#x438;&amp;#x438; &amp;#x43A;&amp;#x43E;&amp;#x43D;&amp;#x444;&amp;#x435;&amp;#x440;&amp;#x435;&amp;#x43D;&amp;#x446;&amp;#x438;&amp;#x438;, &amp;#x447;&amp;#x435;&amp;#x43C;&amp;#x443; &amp;#x44F; &amp;#x442;&amp;#x43E;&amp;#x436;&amp;#x435; &amp;#x440;&amp;#x430;&amp;#x434;. &amp;#x418;&amp;#x442;&amp;#x430;&amp;#x43A;, &amp;#x43F;&amp;#x43E;&amp;#x436;&amp;#x430;&amp;#x43B;&amp;#x443;&amp;#x439; &amp;#x43F;&amp;#x440;&amp;#x438;&amp;#x441;&amp;#x442;&amp;#x443;&amp;#x43F;&amp;#x438;&amp;#x43C;.
    &amp;#x414;&amp;#x43E;&amp;#x43A;&amp;#x43B;&amp;#x430;&amp;#x434; &amp;#x43C;&amp;#x43E;&amp;#x439; &amp;#x43D;&amp;#x430;&amp;#x437;&amp;#x44B;&amp;#x432;&amp;#x430;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; CoffeeScript - &amp;#x441;&amp;#x447;&amp;#x430;&amp;#x441;&amp;#x442;&amp;#x44C;&amp;#x435; &amp;#x434;&amp;#x43B;&amp;#x44F; javascript &amp;#x440;&amp;#x430;&amp;#x437;&amp;#x440;&amp;#x430;&amp;#x431;&amp;#x43E;&amp;#x442;&amp;#x447;&amp;#x438;&amp;#x43A;&amp;#x430;. &amp;#x412;&amp;#x43E;&amp;#x442; &amp;#x441; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;&amp;#x430; &amp;#x43C;&amp;#x44B; &amp;#x438; &amp;#x43D;&amp;#x430;&amp;#x447;&amp;#x43D;&amp;#x435;&amp;#x43C;.
  • &amp;#x41F;&amp;#x43E;&amp;#x434;&amp;#x43D;&amp;#x438;&amp;#x43C;&amp;#x438;&amp;#x442;&amp;#x435; &amp;#x43F;&amp;#x43E;&amp;#x436;&amp;#x430;&amp;#x43B;&amp;#x443;&amp;#x439;&amp;#x441;&amp;#x442;&amp;#x430; &amp;#x440;&amp;#x443;&amp;#x43A;&amp;#x438;, &amp;#x43A;&amp;#x442;&amp;#x43E; &amp;#x438;&amp;#x437; &amp;#x43F;&amp;#x440;&amp;#x438;&amp;#x441;&amp;#x443;&amp;#x442;&amp;#x441;&amp;#x442;&amp;#x432;&amp;#x443;&amp;#x44E;&amp;#x449;&amp;#x438;&amp;#x445; &amp;#x437;&amp;#x43D;&amp;#x430;&amp;#x43A;&amp;#x43E;&amp;#x43C; &amp;#x441; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;&amp;#x43E;&amp;#x43C;.
  • &amp;#x41E;&amp;#x442;&amp;#x43B;&amp;#x438;&amp;#x447;&amp;#x43D;&amp;#x43E;. &amp;#x410; &amp;#x43A;&amp;#x442;&amp;#x43E; &amp;#x437;&amp;#x43D;&amp;#x430;&amp;#x435;&amp;#x442; &amp;#x447;&amp;#x435;&amp;#x43C;&amp;#x443; &amp;#x431;&amp;#x443;&amp;#x434;&amp;#x435;&amp;#x442; &amp;#x440;&amp;#x430;&amp;#x432;&amp;#x43D;&amp;#x43E; &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x432;&amp;#x44B;&amp;#x440;&amp;#x430;&amp;#x436;&amp;#x435;&amp;#x43D;&amp;#x438;&amp;#x435;?
  • &amp;#x41D;&amp;#x43E;&amp;#x43B;&amp;#x44C;?
  • &amp;#x41D;&amp;#x43E;&amp;#x43B;&amp;#x44C;? &amp;#x423;&amp;#x432;&amp;#x44B;, &amp;#x43D;&amp;#x435;&amp;#x442;! 18. &amp;#x41F;&amp;#x43E;&amp;#x447;&amp;#x435;&amp;#x43C;&amp;#x443; &amp;#x442;&amp;#x430;&amp;#x43A;? 1 - &amp;#x412; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;&amp;#x435; &amp;#x434;&amp;#x43B;&amp;#x44F; &amp;#x43E;&amp;#x43F;&amp;#x435;&amp;#x440;&amp;#x430;&amp;#x446;&amp;#x438;&amp;#x439; &amp;#x43A;&amp;#x43E;&amp;#x43D;&amp;#x43A;&amp;#x430;&amp;#x442;&amp;#x435;&amp;#x43D;&amp;#x430;&amp;#x446;&amp;#x438;&amp;#x438; &amp;#x438; &amp;#x441;&amp;#x43B;&amp;#x43E;&amp;#x436;&amp;#x435;&amp;#x43D;&amp;#x438;&amp;#x44F; &amp;#x438;&amp;#x441;&amp;#x43F;&amp;#x43E;&amp;#x43B;&amp;#x44C;&amp;#x437;&amp;#x443;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; &amp;#x441;&amp;#x438;&amp;#x43C;&amp;#x432;&amp;#x43E;&amp;#x43B; &amp;#x201C;+&amp;#x201D;. 2 - &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442; - &amp;#x44F;&amp;#x437;&amp;#x44B;&amp;#x43A; &amp;#x441;&amp;#x43B;&amp;#x430;&amp;#x431;&amp;#x43E; &amp;#x442;&amp;#x438;&amp;#x43F;&amp;#x438;&amp;#x437;&amp;#x438;&amp;#x440;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x43D;&amp;#x43D;&amp;#x44B;&amp;#x439;. &amp;#x417;&amp;#x430; &amp;#x441;&amp;#x447;&amp;#x435;&amp;#x442; &amp;#x44D;&amp;#x442;&amp;#x438;&amp;#x445; &amp;#x434;&amp;#x432;&amp;#x443;&amp;#x445; &amp;#x444;&amp;#x430;&amp;#x43A;&amp;#x442;&amp;#x43E;&amp;#x440;&amp;#x43E;&amp;#x432; &amp;#x43C;&amp;#x44B; &amp;#x43F;&amp;#x43E;&amp;#x43B;&amp;#x443;&amp;#x447;&amp;#x430;&amp;#x435;&amp;#x43C; &amp;#x442;&amp;#x430;&amp;#x43A;&amp;#x438;&amp;#x435; &amp;#x438;&amp;#x43D;&amp;#x442;&amp;#x435;&amp;#x440;&amp;#x435;&amp;#x441;&amp;#x43D;&amp;#x44B;&amp;#x435; &amp;#x44D;&amp;#x444;&amp;#x444;&amp;#x435;&amp;#x43A;&amp;#x442;&amp;#x44B;
  • &amp;#x41A;&amp;#x442;&amp;#x43E; &amp;#x43D;&amp;#x438;&amp;#x431;&amp;#x443;&amp;#x434;&amp;#x44C; &amp;#x43F;&amp;#x43E;&amp;#x43D;&amp;#x438;&amp;#x43C;&amp;#x430;&amp;#x435;&amp;#x442;, &amp;#x43F;&amp;#x43E;&amp;#x447;&amp;#x435;&amp;#x43C;&amp;#x443; &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x442;&amp;#x430;&amp;#x43A;?
  • &amp;#x41E;&amp;#x43A;. &amp;#x410; &amp;#x44D;&amp;#x442;&amp;#x43E;?
  • &amp;#x41D;&amp;#x443; &amp;#x430; &amp;#x44D;&amp;#x442;&amp;#x43E;? &amp;#x41D;&amp;#x435; &amp;#x43E;&amp;#x447;&amp;#x435;&amp;#x43D;&amp;#x44C; &amp;#x43E;&amp;#x447;&amp;#x435;&amp;#x432;&amp;#x438;&amp;#x434;&amp;#x43D;&amp;#x43E;, &amp;#x434;&amp;#x430;?
  • &amp;#x418; &amp;#x432;&amp;#x43E;&amp;#x442; &amp;#x435;&amp;#x449;&amp;#x435;. &amp;#x412;&amp;#x44B; &amp;#x43D;&amp;#x435; &amp;#x434;&amp;#x443;&amp;#x43C;&amp;#x430;&amp;#x439;&amp;#x442;&amp;#x435;, &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x43D;&amp;#x435; random-&amp;#x43D;&amp;#x43E;&amp;#x435; &amp;#x43F;&amp;#x43E;&amp;#x432;&amp;#x435;&amp;#x434;&amp;#x435;&amp;#x43D;&amp;#x438;&amp;#x435;. &amp;#x415;&amp;#x441;&amp;#x442;&amp;#x44C; &amp;#x43F;&amp;#x440;&amp;#x430;&amp;#x432;&amp;#x438;&amp;#x43B;&amp;#x430;, &amp;#x43F;&amp;#x43E; &amp;#x43A;&amp;#x43E;&amp;#x442;&amp;#x43E;&amp;#x440;&amp;#x44B;&amp;#x43C; &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x440;&amp;#x430;&amp;#x431;&amp;#x43E;&amp;#x442;&amp;#x430;&amp;#x435;&amp;#x442;. &amp;#x41F;&amp;#x440;&amp;#x430;&amp;#x432;&amp;#x434;&amp;#x430; &amp;#x438;&amp;#x445; &amp;#x434;&amp;#x43E;&amp;#x441;&amp;#x442;&amp;#x430;&amp;#x442;&amp;#x43E;&amp;#x447;&amp;#x43D;&amp;#x43E; &amp;#x441;&amp;#x43B;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x43E; &amp;#x43E;&amp;#x431;&amp;#x44A;&amp;#x44F;&amp;#x441;&amp;#x43D;&amp;#x438;&amp;#x442;&amp;#x44C; &amp;#x43B;&amp;#x43E;&amp;#x433;&amp;#x438;&amp;#x447;&amp;#x435;&amp;#x441;&amp;#x43A;&amp;#x438; &amp;#x438; &amp;#x43F;&amp;#x440;&amp;#x44F;&amp;#x43C;&amp;#x43E; &amp;#x441;&amp;#x43A;&amp;#x430;&amp;#x436;&amp;#x435;&amp;#x43C; &amp;#x43D;&amp;#x435; &amp;#x43B;&amp;#x435;&amp;#x433;&amp;#x43A;&amp;#x43E; &amp;#x437;&amp;#x430;&amp;#x43F;&amp;#x43E;&amp;#x43C;&amp;#x43D;&amp;#x438;&amp;#x442;&amp;#x44C;.
  • &amp;#x415;&amp;#x449;&amp;#x435; &amp;#x43D;&amp;#x435;&amp;#x43C;&amp;#x43D;&amp;#x43E;&amp;#x433;&amp;#x43E; &amp;#x441;&amp;#x442;&amp;#x440;&amp;#x430;&amp;#x43D;&amp;#x43D;&amp;#x43E;&amp;#x441;&amp;#x442;&amp;#x435;&amp;#x439;, &amp;#x441; &amp;#x43A;&amp;#x43E;&amp;#x442;&amp;#x43E;&amp;#x440;&amp;#x44B;&amp;#x43C;&amp;#x438; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;-&amp;#x43F;&amp;#x440;&amp;#x43E;&amp;#x433;&amp;#x440;&amp;#x430;&amp;#x43C;&amp;#x43C;&amp;#x438;&amp;#x441;&amp;#x442; &amp;#x441;&amp;#x442;&amp;#x430;&amp;#x43B;&amp;#x43A;&amp;#x438;&amp;#x432;&amp;#x430;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; &amp;#x435;&amp;#x436;&amp;#x435;&amp;#x434;&amp;#x43D;&amp;#x435;&amp;#x432;&amp;#x43D;&amp;#x43E;. Typeof. &amp;#x41F;&amp;#x43E;&amp;#x43A;&amp;#x430;&amp;#x437;&amp;#x44B;&amp;#x432;&amp;#x430;&amp;#x435;&amp;#x442; &amp;#x442;&amp;#x43E; &amp;#x447;&amp;#x442;&amp;#x43E; &amp;#x43D;&amp;#x430;&amp;#x434;&amp;#x43E; &amp;#x434;&amp;#x43B;&amp;#x44F; &amp;#x447;&amp;#x438;&amp;#x441;&amp;#x435;&amp;#x43B;, &amp;#x441;&amp;#x442;&amp;#x440;&amp;#x43E;&amp;#x43A;, &amp;#x43E;&amp;#x431;&amp;#x44A;&amp;#x435;&amp;#x43A;&amp;#x442;&amp;#x43E;&amp;#x432;
  • &amp;#x410; &amp;#x441; &amp;#x43C;&amp;#x430;&amp;#x441;&amp;#x441;&amp;#x438;&amp;#x432;&amp;#x430;&amp;#x43C;&amp;#x438; &amp;#x43D;&amp;#x430;&amp;#x43A;&amp;#x43B;&amp;#x430;&amp;#x434;&amp;#x43E;&amp;#x447;&amp;#x43A;&amp;#x430;. &amp;#x418; null, &amp;#x43F;&amp;#x440;&amp;#x44F;&amp;#x43C;&amp;#x43E; &amp;#x441;&amp;#x43A;&amp;#x430;&amp;#x436;&amp;#x435;&amp;#x43C;, &amp;#x441;&amp;#x43E;&amp;#x432;&amp;#x441;&amp;#x435;&amp;#x43C; &amp;#x43D;&amp;#x435; &amp;#x43E;&amp;#x431;&amp;#x44A;&amp;#x435;&amp;#x43A;&amp;#x442;.
  • &amp;#x421; &amp;#x431;&amp;#x443;&amp;#x43B;&amp;#x435;&amp;#x432;&amp;#x441;&amp;#x43A;&amp;#x438;&amp;#x43C;&amp;#x438; &amp;#x43F;&amp;#x435;&amp;#x440;&amp;#x435;&amp;#x43C;&amp;#x435;&amp;#x43D;&amp;#x43D;&amp;#x44B;&amp;#x43C;&amp;#x438; &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x440;&amp;#x430;&amp;#x431;&amp;#x43E;&amp;#x442;&amp;#x430;&amp;#x435;&amp;#x442;. &amp;#x41F;&amp;#x440;&amp;#x430;&amp;#x432;&amp;#x434;&amp;#x430; &amp;#x43D;&amp;#x435; &amp;#x441;&amp;#x43E; &amp;#x432;&amp;#x441;&amp;#x435;&amp;#x43C;&amp;#x438;. &amp;#x417;&amp;#x430; &amp;#x447;&amp;#x435;&amp;#x43C; &amp;#x432;&amp;#x43E;&amp;#x43E;&amp;#x431;&amp;#x449;&amp;#x435; &amp;#x432; &amp;#x44F;&amp;#x437;&amp;#x44B;&amp;#x43A;&amp;#x435; &amp;#x442;&amp;#x430;&amp;#x43A;&amp;#x430;&amp;#x44F; &amp;#x43A;&amp;#x43E;&amp;#x43D;&amp;#x441;&amp;#x442;&amp;#x440;&amp;#x443;&amp;#x43A;&amp;#x446;&amp;#x438;&amp;#x44F;, &amp;#x43D;&amp;#x435; &amp;#x441;&amp;#x43E;&amp;#x432;&amp;#x441;&amp;#x435;&amp;#x43C; &amp;#x43F;&amp;#x43E;&amp;#x43D;&amp;#x44F;&amp;#x442;&amp;#x43D;&amp;#x43E;.
  • &amp;#x41A;&amp;#x43B;&amp;#x430;&amp;#x441;&amp;#x441;&amp;#x438;&amp;#x447;&amp;#x435;&amp;#x441;&amp;#x43A;&amp;#x438;&amp;#x439; &amp;#x43F;&amp;#x440;&amp;#x438;&amp;#x43C;&amp;#x435;&amp;#x440;, &amp;#x43A;&amp;#x43E;&amp;#x433;&amp;#x434;&amp;#x430; &amp;#x43F;&amp;#x440;&amp;#x438;&amp;#x445;&amp;#x43E;&amp;#x434;&amp;#x438;&amp;#x442; &amp;#x43C;&amp;#x43E;&amp;#x43B;&amp;#x43E;&amp;#x434;&amp;#x43E;&amp;#x439; &amp;#x440;&amp;#x430;&amp;#x437;&amp;#x440;&amp;#x430;&amp;#x431;&amp;#x43E;&amp;#x442;&amp;#x447;&amp;#x438;&amp;#x43A;, &amp;#x438; &amp;#x432;&amp;#x438;&amp;#x434;&amp;#x44F; &amp;#x442;&amp;#x430;&amp;#x43A;&amp;#x43E;&amp;#x439; &amp;#x43A;&amp;#x43E;&amp;#x434;,
  • , &amp;#x434;&amp;#x43E;&amp;#x43F;&amp;#x438;&amp;#x441;&amp;#x44B;&amp;#x432;&amp;#x430;&amp;#x435;&amp;#x442; &amp;#x435;&amp;#x433;&amp;#x43E; &amp;#x434;&amp;#x43E; &amp;#x442;&amp;#x430;&amp;#x43A;&amp;#x43E;&amp;#x433;&amp;#x43E;
  • &amp;#x41F;&amp;#x43E;&amp;#x434;&amp;#x440;&amp;#x430;&amp;#x437;&amp;#x443;&amp;#x43C;&amp;#x435;&amp;#x432;&amp;#x430;&amp;#x44F; &amp;#x44D;&amp;#x442;&amp;#x43E;
  • &amp;#x41D;&amp;#x43E; &amp;#x43C;&amp;#x44B; &amp;#x442;&amp;#x43E; &amp;#x437;&amp;#x43D;&amp;#x430;&amp;#x435;&amp;#x43C; &amp;#x447;&amp;#x442;&amp;#x43E; &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x43F;&amp;#x43E;&amp;#x43B;&amp;#x443;&amp;#x447;&amp;#x430;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; &amp;#x432;&amp;#x43E;&amp;#x442; &amp;#x442;&amp;#x430;&amp;#x43A; &amp;#x43D;&amp;#x430; &amp;#x441;&amp;#x430;&amp;#x43C;&amp;#x43E;&amp;#x43C; &amp;#x434;&amp;#x435;&amp;#x43B;&amp;#x435;.
  • &amp;#x41D;&amp;#x430;&amp;#x441;&amp;#x43B;&amp;#x435;&amp;#x434;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x43D;&amp;#x438;&amp;#x435;. &amp;#x41B;&amp;#x44E;&amp;#x431;&amp;#x438;&amp;#x43C;&amp;#x430;&amp;#x44F; &amp;#x442;&amp;#x435;&amp;#x43C;&amp;#x430; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;-&amp;#x440;&amp;#x430;&amp;#x437;&amp;#x440;&amp;#x430;&amp;#x431;&amp;#x43E;&amp;#x442;&amp;#x447;&amp;#x438;&amp;#x43A;&amp;#x43E;&amp;#x432;. &amp;#x41F;&amp;#x43E;&amp;#x434;&amp;#x43D;&amp;#x438;&amp;#x43C;&amp;#x438;&amp;#x442;&amp;#x435; &amp;#x440;&amp;#x443;&amp;#x43A;&amp;#x438;, &amp;#x43A;&amp;#x442;&amp;#x43E; &amp;#x43F;&amp;#x43E;&amp;#x43D;&amp;#x438;&amp;#x43C;&amp;#x430;&amp;#x435;&amp;#x442; &amp;#x43A;&amp;#x430;&amp;#x43A; &amp;#x440;&amp;#x430;&amp;#x431;&amp;#x43E;&amp;#x442;&amp;#x430;&amp;#x435;&amp;#x442; &amp;#x43D;&amp;#x430;&amp;#x441;&amp;#x43B;&amp;#x435;&amp;#x434;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x43D;&amp;#x438;&amp;#x435; &amp;#x432; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;&amp;#x435;? &amp;#x41F;&amp;#x43E;&amp;#x434;&amp;#x43D;&amp;#x438;&amp;#x43C;&amp;#x438;&amp;#x442;&amp;#x435; &amp;#x440;&amp;#x443;&amp;#x43A;&amp;#x438;, &amp;#x43A;&amp;#x442;&amp;#x43E; &amp;#x441;&amp;#x447;&amp;#x438;&amp;#x442;&amp;#x430;&amp;#x435;&amp;#x442; &amp;#x435;&amp;#x433;&amp;#x43E; &amp;#x441;&amp;#x442;&amp;#x440;&amp;#x430;&amp;#x43D;&amp;#x43D;&amp;#x44B;&amp;#x43C;?
    &amp;#x41D;&amp;#x443; &amp;#x43A;&amp;#x430;&amp;#x43A; &amp;#x431;&amp;#x44B; &amp;#x434;&amp;#x430;.
  • &amp;#x412;&amp;#x43E;&amp;#x442; &amp;#x435;&amp;#x449;&amp;#x435; &amp;#x441;&amp;#x43F;&amp;#x438;&amp;#x441;&amp;#x43E;&amp;#x43A; &amp;#x432;&amp;#x43E;&amp;#x437;&amp;#x43C;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x43E;&amp;#x441;&amp;#x442;&amp;#x435;&amp;#x439; &amp;#x44F;&amp;#x437;&amp;#x44B;&amp;#x43A;&amp;#x430; &amp;#x440;&amp;#x430;&amp;#x437;&amp;#x43D;&amp;#x43E;&amp;#x439; &amp;#x441;&amp;#x442;&amp;#x435;&amp;#x43F;&amp;#x435;&amp;#x43D;&amp;#x438; &amp;#x43E;&amp;#x43F;&amp;#x430;&amp;#x441;&amp;#x43D;&amp;#x43E;&amp;#x441;&amp;#x442;&amp;#x438;, &amp;#x43D;&amp;#x430; &amp;#x43A;&amp;#x43E;&amp;#x442;&amp;#x43E;&amp;#x440;&amp;#x44B;&amp;#x445; &amp;#x43C;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x43E; &amp;#x447;&amp;#x442;&amp;#x43E; &amp;#x43D;&amp;#x430;&amp;#x437;&amp;#x44B;&amp;#x432;&amp;#x430;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F;, &amp;#x43F;&amp;#x43E;&amp;#x43F;&amp;#x430;&amp;#x441;&amp;#x442;&amp;#x44C;&amp;#x441;&amp;#x44F;.

    &amp;#x422;.&amp;#x435;. &amp;#x441;&amp;#x430;&amp;#x43C;&amp;#x438; &amp;#x43F;&amp;#x43E; &amp;#x441;&amp;#x435;&amp;#x431;&amp;#x435; &amp;#x43E;&amp;#x43D;&amp;#x438; - &amp;#x43D;&amp;#x435; &amp;#x437;&amp;#x43B;&amp;#x43E;, &amp;#x43D;&amp;#x43E; &amp;#x438;&amp;#x445; &amp;#x43E;&amp;#x447;&amp;#x435;&amp;#x43D;&amp;#x44C; &amp;#x43B;&amp;#x435;&amp;#x433;&amp;#x43A;&amp;#x43E; &amp;#x438;&amp;#x441;&amp;#x43F;&amp;#x43E;&amp;#x43B;&amp;#x44C;&amp;#x437;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x442;&amp;#x44C; &amp;#x43D;&amp;#x435;&amp;#x432;&amp;#x435;&amp;#x440;&amp;#x43D;&amp;#x44B;&amp;#x43C; &amp;#x441;&amp;#x43F;&amp;#x43E;&amp;#x441;&amp;#x43E;&amp;#x431;&amp;#x43E;&amp;#x43C;, &amp;#x43B;&amp;#x438;&amp;#x431;&amp;#x43E; &amp;#x441;&amp;#x43B;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x43E; &amp;#x438;&amp;#x441;&amp;#x43F;&amp;#x43E;&amp;#x43B;&amp;#x44C;&amp;#x437;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x442;&amp;#x44C; &amp;#x432;&amp;#x435;&amp;#x440;&amp;#x43D;&amp;#x44B;&amp;#x43C;.


  • &amp;#x421;&amp;#x430;&amp;#x43C;&amp;#x43E;&amp;#x435; &amp;#x43F;&amp;#x43B;&amp;#x43E;&amp;#x445;&amp;#x43E;&amp;#x435; &amp;#x432; &amp;#x44D;&amp;#x442;&amp;#x43E;&amp;#x439; &amp;#x441;&amp;#x438;&amp;#x442;&amp;#x443;&amp;#x430;&amp;#x446;&amp;#x438;&amp;#x438;, &amp;#x447;&amp;#x442;&amp;#x43E; &amp;#x445;&amp;#x43E;&amp;#x440;&amp;#x43E;&amp;#x448;&amp;#x438;&amp;#x439; &amp;#x43A;&amp;#x43E;&amp;#x434; &amp;#x441; &amp;#x442;&amp;#x43E;&amp;#x447;&amp;#x43A;&amp;#x438; &amp;#x437;&amp;#x440;&amp;#x435;&amp;#x43D;&amp;#x438;&amp;#x44F; &amp;#x44F;&amp;#x437;&amp;#x44B;&amp;#x43A;&amp;#x430; &amp;#x441;&amp;#x43B;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x43E; &amp;#x447;&amp;#x438;&amp;#x442;&amp;#x430;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; &amp;#x436;&amp;#x438;&amp;#x432;&amp;#x44B;&amp;#x43C; &amp;#x447;&amp;#x435;&amp;#x43B;&amp;#x43E;&amp;#x432;&amp;#x435;&amp;#x43A;&amp;#x43E;&amp;#x43C;.
  • &amp;#x412;&amp;#x43E;&amp;#x442; &amp;#x43F;&amp;#x440;&amp;#x438;&amp;#x43C;&amp;#x435;&amp;#x440; &amp;#x445;&amp;#x43E;&amp;#x440;&amp;#x43E;&amp;#x448;&amp;#x435;&amp;#x433;&amp;#x43E; &amp;#x43A;&amp;#x43E;&amp;#x434;&amp;#x430;.
  • &amp;#x418;&amp;#x442;&amp;#x430;&amp;#x43A;, CoffeeScript


  • &amp;#x412;&amp;#x430;&amp;#x43C; &amp;#x43D;&amp;#x435; &amp;#x43F;&amp;#x440;&amp;#x438;&amp;#x434;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; &amp;#x441;&amp;#x430;&amp;#x43C;&amp;#x438;&amp;#x43C; &amp;#x43E;&amp;#x431;&amp;#x44A;&amp;#x44F;&amp;#x432;&amp;#x43B;&amp;#x44F;&amp;#x442;&amp;#x44C; &amp;#x43F;&amp;#x435;&amp;#x440;&amp;#x435;&amp;#x43C;&amp;#x435;&amp;#x43D;&amp;#x43D;&amp;#x44B;&amp;#x435;.
  • &amp;#x423;&amp;#x441;&amp;#x43B;&amp;#x43E;&amp;#x432;&amp;#x438;&amp;#x44F;
  • &amp;#x41C;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x43E; &amp;#x432;&amp;#x44B;&amp;#x442;&amp;#x432;&amp;#x43E;&amp;#x440;&amp;#x44F;&amp;#x442;&amp;#x44C; &amp;#x442;&amp;#x430;&amp;#x43A;&amp;#x438;&amp;#x435; &amp;#x444;&amp;#x43E;&amp;#x43A;&amp;#x443;&amp;#x441;&amp;#x44B;
  • &amp;#x412;&amp;#x430;&amp;#x43C; &amp;#x43D;&amp;#x435; &amp;#x43F;&amp;#x440;&amp;#x438;&amp;#x434;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; &amp;#x44F;&amp;#x432;&amp;#x43D;&amp;#x43E; &amp;#x443;&amp;#x43A;&amp;#x430;&amp;#x437;&amp;#x44B;&amp;#x432;&amp;#x430;&amp;#x442;&amp;#x44C; return
  • &amp;#x41E;&amp;#x431;&amp;#x44A;&amp;#x435;&amp;#x43A;&amp;#x442;&amp;#x44B;








  • &amp;#x412;&amp;#x43E;&amp;#x437;&amp;#x43C;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x44B; &amp;#x432;&amp;#x430;&amp;#x440;&amp;#x438;&amp;#x430;&amp;#x43D;&amp;#x442;&amp;#x44B; &amp;#x43A;&amp;#x43E;&amp;#x43D;&amp;#x435;&amp;#x447;&amp;#x43D;&amp;#x43E;. &amp;#x41D;&amp;#x430;&amp;#x43F;&amp;#x438;&amp;#x441;&amp;#x430;&amp;#x43D;&amp;#x430; &amp;#x43D;&amp;#x435; &amp;#x43E;&amp;#x434;&amp;#x43D;&amp;#x430; &amp;#x431;&amp;#x438;&amp;#x431;&amp;#x43B;&amp;#x438;&amp;#x43E;&amp;#x442;&amp;#x435;&amp;#x43A;&amp;#x430;, &amp;#x440;&amp;#x435;&amp;#x430;&amp;#x43B;&amp;#x438;&amp;#x437;&amp;#x443;&amp;#x44E;&amp;#x449;&amp;#x430;&amp;#x44F; &amp;#x43A;&amp;#x43B;&amp;#x430;&amp;#x441;&amp;#x441;&amp;#x438;&amp;#x447;&amp;#x435;&amp;#x441;&amp;#x43A;&amp;#x43E;&amp;#x435; &amp;#x43D;&amp;#x430;&amp;#x441;&amp;#x43B;&amp;#x435;&amp;#x434;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x43D;&amp;#x438;&amp;#x435; &amp;#x43A;&amp;#x43B;&amp;#x430;&amp;#x441;&amp;#x441;&amp;#x43E;&amp;#x432; &amp;#x432; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;&amp;#x435;.
    &amp;#x41D;&amp;#x430;&amp;#x434;&amp;#x43E; &amp;#x442;&amp;#x43E;&amp;#x43B;&amp;#x44C;&amp;#x43A;&amp;#x43E; &amp;#x43F;&amp;#x43E;&amp;#x43D;&amp;#x438;&amp;#x43C;&amp;#x430;&amp;#x442;&amp;#x44C;, &amp;#x447;&amp;#x442;&amp;#x43E; &amp;#x43E;&amp;#x442; &amp;#x43E;&amp;#x441;&amp;#x43E;&amp;#x431;&amp;#x435;&amp;#x43D;&amp;#x43D;&amp;#x43E;&amp;#x441;&amp;#x442;&amp;#x435;&amp;#x439; &amp;#x441;&amp;#x438;&amp;#x43D;&amp;#x442;&amp;#x430;&amp;#x43A;&amp;#x441;&amp;#x438;&amp;#x441;&amp;#x430; &amp;#x432;&amp;#x441;&amp;#x435; &amp;#x440;&amp;#x430;&amp;#x432;&amp;#x43D;&amp;#x43E; &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x43D;&amp;#x435; &amp;#x441;&amp;#x43F;&amp;#x430;&amp;#x441;&amp;#x430;&amp;#x435;&amp;#x442;.
    &amp;#x41D;&amp;#x443; &amp;#x438;, &amp;#x432;&amp;#x43E;&amp;#x43E;&amp;#x431;&amp;#x449;&amp;#x435; &amp;#x433;&amp;#x43E;&amp;#x432;&amp;#x43E;&amp;#x440;&amp;#x44F;, &amp;#x43F;&amp;#x440;&amp;#x43E;&amp;#x442;&amp;#x43E;&amp;#x442;&amp;#x438;&amp;#x43F;&amp;#x43D;&amp;#x43E;&amp;#x435; &amp;#x43D;&amp;#x430;&amp;#x441;&amp;#x43B;&amp;#x435;&amp;#x434;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x43D;&amp;#x438;&amp;#x435; - &amp;#x43D;&amp;#x435; &amp;#x435;&amp;#x441;&amp;#x442;&amp;#x44C; &amp;#x437;&amp;#x43B;&amp;#x43E;. &amp;#x41F;&amp;#x440;&amp;#x43E;&amp;#x441;&amp;#x442;&amp;#x43E; &amp;#x435;&amp;#x433;&amp;#x43E; &amp;#x43D;&amp;#x430;&amp;#x434;&amp;#x43E; &amp;#x443;&amp;#x43C;&amp;#x435;&amp;#x442;&amp;#x44C; &amp;#x433;&amp;#x43E;&amp;#x442;&amp;#x43E;&amp;#x432;&amp;#x438;&amp;#x442;&amp;#x44C;.

  • &amp;#x422;&amp;#x435;&amp;#x43F;&amp;#x435;&amp;#x440;&amp;#x44C; &amp;#x434;&amp;#x430;&amp;#x432;&amp;#x430;&amp;#x439;&amp;#x442;&amp;#x435; &amp;#x43D;&amp;#x435;&amp;#x43C;&amp;#x43D;&amp;#x43E;&amp;#x433;&amp;#x43E; &amp;#x43E;&amp;#x442;&amp;#x432;&amp;#x43B;&amp;#x435;&amp;#x447;&amp;#x435;&amp;#x43C;&amp;#x441;&amp;#x44F; &amp;#x438; &amp;#x43F;&amp;#x43E;&amp;#x438;&amp;#x433;&amp;#x440;&amp;#x430;&amp;#x435;&amp;#x43C; &amp;#x432; &amp;#x438;&amp;#x433;&amp;#x440;&amp;#x443;!






  • &amp;#x423;&amp;#x440;&amp;#x430;!
  • &amp;#x41C;&amp;#x43E;&amp;#x436;&amp;#x43D;&amp;#x43E; &amp;#x435;&amp;#x449;&amp;#x435; &amp;#x434;&amp;#x43E;&amp;#x431;&amp;#x430;&amp;#x432;&amp;#x438;&amp;#x442;&amp;#x44C; &amp;#x422;&amp;#x435;&amp;#x43A;&amp;#x438;&amp;#x43B;&amp;#x443;, &amp;#x43D;&amp;#x43E; &amp;#x44D;&amp;#x442;&amp;#x43E; &amp;#x443;&amp;#x436;&amp;#x435; &amp;#x434;&amp;#x440;&amp;#x443;&amp;#x433;&amp;#x430;&amp;#x44F; &amp;#x438;&amp;#x441;&amp;#x442;&amp;#x43E;&amp;#x440;&amp;#x438;&amp;#x44F;.
  • &amp;#x41A;&amp;#x43E;&amp;#x43C;&amp;#x43F;&amp;#x438;&amp;#x43B;&amp;#x438;&amp;#x440;&amp;#x443;&amp;#x435;&amp;#x442;&amp;#x441;&amp;#x44F; &amp;#x432; JavaScript.
    &amp;#x41F;&amp;#x440;&amp;#x430;&amp;#x432;&amp;#x438;&amp;#x43B;&amp;#x430; &amp;#x43A;&amp;#x43E;&amp;#x43C;&amp;#x43F;&amp;#x438;&amp;#x43B;&amp;#x44F;&amp;#x446;&amp;#x438;&amp;#x438; &amp;#x43F;&amp;#x440;&amp;#x43E;&amp;#x437;&amp;#x440;&amp;#x430;&amp;#x447;&amp;#x43D;&amp;#x44B; &amp;#x438; &amp;#x43E;&amp;#x434;&amp;#x43D;&amp;#x43E;&amp;#x437;&amp;#x43D;&amp;#x430;&amp;#x447;&amp;#x43D;&amp;#x44B;.
    &amp;#x412;&amp;#x441;&amp;#x435; &amp;#x447;&amp;#x442;&amp;#x43E; &amp;#x432;&amp;#x44B; &amp;#x43C;&amp;#x43E;&amp;#x436;&amp;#x435;&amp;#x442;&amp;#x435; &amp;#x43D;&amp;#x430;&amp;#x43F;&amp;#x438;&amp;#x441;&amp;#x430;&amp;#x442;&amp;#x44C; &amp;#x43D;&amp;#x430; &amp;#x44F;&amp;#x432;&amp;#x430;&amp;#x441;&amp;#x43A;&amp;#x440;&amp;#x438;&amp;#x43F;&amp;#x442;&amp;#x435;, &amp;#x432;&amp;#x44B; &amp;#x43C;&amp;#x43E;&amp;#x436;&amp;#x435;&amp;#x442;&amp;#x435; &amp;#x43D;&amp;#x430;&amp;#x43F;&amp;#x438;&amp;#x441;&amp;#x430;&amp;#x442;&amp;#x44C; &amp;#x438; &amp;#x43D;&amp;#x430; coffeescript.
  • &amp;#x421;&amp;#x433;&amp;#x435;&amp;#x43D;&amp;#x435;&amp;#x440;&amp;#x438;&amp;#x440;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x43D;&amp;#x43D;&amp;#x44B;&amp;#x439; &amp;#x43A;&amp;#x43E;&amp;#x434; &amp;#x43F;&amp;#x440;&amp;#x43E;&amp;#x445;&amp;#x43E;&amp;#x434;&amp;#x438;&amp;#x442; JSLint code quality tool &amp;#x431;&amp;#x435;&amp;#x437; &amp;#x43F;&amp;#x440;&amp;#x435;&amp;#x434;&amp;#x443;&amp;#x43F;&amp;#x440;&amp;#x435;&amp;#x436;&amp;#x434;&amp;#x435;&amp;#x43D;&amp;#x438;&amp;#x439;.

  • &amp;#x412;&amp;#x44B; &amp;#x43C;&amp;#x43E;&amp;#x436;&amp;#x435;&amp;#x442;&amp;#x435; &amp;#x43F;&amp;#x440;&amp;#x43E;&amp;#x434;&amp;#x43E;&amp;#x43B;&amp;#x436;&amp;#x430;&amp;#x442;&amp;#x44C; &amp;#x438;&amp;#x441;&amp;#x43F;&amp;#x43E;&amp;#x43B;&amp;#x44C;&amp;#x437;&amp;#x43E;&amp;#x432;&amp;#x430;&amp;#x442;&amp;#x44C; &amp;#x432;&amp;#x43D;&amp;#x435;&amp;#x448;&amp;#x43D;&amp;#x438;&amp;#x435; &amp;#x431;&amp;#x438;&amp;#x431;&amp;#x43B;&amp;#x438;&amp;#x43E;&amp;#x442;&amp;#x435;&amp;#x43A;&amp;#x438; &amp;#x442;&amp;#x430;&amp;#x43A; &amp;#x436;&amp;#x435; &amp;#x43A;&amp;#x430;&amp;#x43A; &amp;#x438; &amp;#x440;&amp;#x430;&amp;#x43D;&amp;#x44C;&amp;#x448;&amp;#x435;.





  • Coffescript - счастье для javascript-разработчика

    1. 1. COFFEESCRIPT счастье для javascript разработчика Иван Немытченко Омск, 26 июня 2010
    2. 2. JAVASCRIPT
    3. 3. var a = "3"; 2+a-a-2 ==
    4. 4. var a = "3"; 2+a-a-2 == 18
    5. 5. '' == '0' // false 0 == '' // true 0 == '0' // true
    6. 6. '' == '0' // false 0 == '' // true 0 == '0' // true false == 'false' // false false == '0' // true
    7. 7. '' == '0' // false 0 == '' // true 0 == '0' // true false == 'false' // false false == '0' // true false == undefined // false false == null // false null == undefined // true
    8. 8. '' == '0' // false 0 == '' // true 0 == '0' // true false == 'false' // false false == '0' // true false == undefined // false false == null // false null == undefined // true ' trn ' == 0 // true NaN === NaN // false
    9. 9. typeof(1) // "number" typeof('a') // "string" typeof({a:1}) // "object"
    10. 10. typeof(1) // "number" typeof('a') // "string" typeof({a:1}) // "object" typeof([1,2]) // "object" typeof(null) // "object"
    11. 11. typeof(1) // "number" typeof('a') // "string" typeof({a:1}) // "object" typeof([1,2]) // "object" typeof(null) // "object" typeof(false) // "boolean" typeof(new Boolean(false)) // "object"
    12. 12. if(a == b) c = 3;
    13. 13. if(a == b) c = 3; doSomething();
    14. 14. if(a == b) c = 3; doSomething(); if(a == b){ c = 3; doSomething(); }
    15. 15. if(a == b) c = 3; doSomething(); if(a == b){ c = 3; } doSomething();
    16. 16. глобальные переменные точка с запятой прототипное наследование with switch eval
    17. 17. JAVASCRIPT ПЛОХОЙ КОД ЛЕГКО ПИСАТЬ
    18. 18. JAVASCRIPT ХОРОШИЙ КОД СЛОЖНО ПИСАТЬ
    19. 19. JAVASCRIPT ХОРОШИЙ КОД СЛОЖНО ЧИТАТЬ
    20. 20. JAVASCRIPT var _a, _b, age, ages, child; var __hasProp = Object.prototype.hasOwnProperty; ages = (function() { _a = []; _b = years_old; for (child in _b) { if (__hasProp.call(_b, child)) { age = _b[child]; _a.push(child + " is " + age); }} return _a; })();
    21. 21. COFFEESCRIPT INSPIRED BY
    22. 22. COFFEESCRIPT INSPIRED BY
    23. 23. COFFEESCRIPT INSPIRED BY
    24. 24. Все является выражением
    25. 25. Условия
    26. 26. Условия
    27. 27. Функции
    28. 28. Объекты
    29. 29. Произвольное кол-во параметров race: (winner, runners...) -> print winner, runners
    30. 30. Проверка на существование alert "Yay!" if margincon? if ((typeof margincon !== "undefined" && margincon !== null)) { alert("Yay!"); }
    31. 31. Интервалы (ranges) numbers: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] three_to_six: numbers[3..6] numbers_copy: numbers[0...numbers.length] numbers[3..6]: [-3, -4, -5, -6]
    32. 32. Проход по массиву (итерации) cubed_list: math.cube num for num in list countdown: num for num in [10..1]
    33. 33. Проход по хэшу (свойствам объекта) years_old: {max: 10, ida: 9, tim: 11} ages: for child, age of years_old child + " is " + age
    34. 34. Присвоение по паттерну bait: 1000 and_switch: 0 [bait, and_switch]: [and_switch, bait]
    35. 35. Строки moby_dick: "Lorem ipsum dolor var moby_dick; sit amet, consectetur moby_dick = "Lorem ipsum dolor adipiscing elit." sit amet, consectetur adipiscing elit."; html: ''' var html; <strong> html = '<strong>n cup of cup of coffeescript coffeescriptn</strong>'; </strong> ''' author: "Wittgenstein" quote: "A picture is a fact. -- $author" sentence: "${ 22 / 7 } is a decent approximation of π"
    36. 36. Наследование
    37. 37. Наследование Base2 PrototypeJS JS.Class
    38. 38. brain-safe way Наследование class Animal move: (meters) -> alert @name + " moved " + meters + "m." class Snake extends Animal constructor: (name) -> @name: name move: -> alert "Slithering..." super 5
    39. 39. Собери всю коллекцию! HTML CSS JAVASCRIPT
    40. 40. HTML <article id='id1'> <section class='a1'> Lorem ipsum </section> <section class='a2'> Sit dolor </section> </article>
    41. 41. HTML → HAML %article#id1 %section.a1 Lorem ipsum %section.a2 Sit dolor
    42. 42. CSS article { margin: 2em 0; } article section { text-align: right; }
    43. 43. CSS → SASS article margin: 2em 0 section text-align: right
    44. 44. JAVASCRIPT var margincon; margincon = { date: "26.06.2010" }; if ((typeof margincon !== "undefined" && margincon !== null)) { alert("Yay!"); }
    45. 45. JAVASCRIPT → COFFEESCRIPT margincon: {date: "26.06.2010"} alert "Yay!" if margincon?
    46. 46. HTML → HAML CSS → SASS JAVASCRIPT → COFFEESCRIPT
    47. 47. HTML → HAML CSS → SASS JAVASCRIPT → COFFEESCRIPT JSON → TEQUILA
    48. 48. COFFEESCRIPT .coffee → .js
    49. 49. COFFEESCRIPT
    50. 50. COFFEESCRIPT
    51. 51. УСТАНОВКА Node.js http://github.com/jashkenas/coffee-script sudo bin/cake install
    52. 52. УСТАНОВКА Node.js http://github.com/jashkenas/coffee-script sudo bin/cake install brew install coffee-script
    53. 53. УСТАНОВКА ... <script type="text/coffeescript"> alert "Inline scripting!" </script> ...
    54. 54. thnx to @drnic
    55. 55. http://coffeescript.org http://jazzcloud.net http://twitter.com/inem

    ×