This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Rx from 'rxjs'; | |
export const once = (fn, context) => { | |
let result; | |
return function() { | |
if (fn) { | |
result = fn.apply(context || this, arguments); | |
fn = null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var reverseCall = function (argument, func) { | |
return func(argument); | |
}; | |
var compose = function (funcs) { | |
return function (argument) { | |
return funcs.reduce(reverseCall, argument); | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; write function which counts creature names | |
#_(...) | |
; store result in vector | |
#_(...) | |
; rewrite function to return quantity of names and age of creature | |
#_(...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; and now, we gonna write first function | |
(defn is-dragon? ; name ? | |
"Function which takes a creature, | |
and check if this creature is dragon" ; doc | |
[creature] ; args | |
(if (= "dragon" (:species creature)) ; body | |
true | |
false)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def zenek | |
{:names ["Zenek" "Miażdżyciel gnatów" "Długouchy leń"] | |
:species "dachshund" | |
:age 109 | |
:health :good}) | |
; let's decompose this shit! | |
(def zenek-names | |
["Zenek" "Miażdżyciel gnatów" "Długouchy leń"]) ; wektory — zbiory o określonej kolejności |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(+ 100 45) ; składnia jest banalnie, cudownie prosta: | |
; najpierw funkcja, potem argumenty, wszystko ujęte w nawiasy. | |
(vector 1 3 4 65 7) ; Wszystko co jest ujęte w nawiasy nazywamy formą (lub wyrażeniem) | |
(+ 1 2 3 4 5) ; dodawanie jest funkcją mogącą przyjąć nieskończoną liczbę argumentów | |
(/ 10 5) | |
(/ 5 6) ; Clojure ma specjalny typ liczbowy dla ułamków, po co? | |
(def x (/ 5 6)) ; definiowanie wartości | |
(float x) | |
(* 5 (+ 4 3)) ; zagnieżdżanie form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn dragon? [creature] | |
(if (= "dragon" (:species creature)) | |
true | |
false)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
font-size:100%; | |
} | |
body { | |
color:#333; | |
line-height:1.56; | |
} | |
h1, h2, h3, h4 { | |
font-size:1rem; | |
font-weight:400; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<itle>Podstawka do HTML</itle> | |
<link rel="stylesheet" type="text/css" href="base.css"> | |
</head> | |
<body> | |
<section class="content"> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ustalamy rozmiar tekstu bazowego | |
html { | |
font-size:100%; | |
} | |
body { | |
color:#333; // ustalamy kolor tekstu, dlaczego nie «black», dlaczego nie «#000» | |
line-height:1.56; // interlinia, odległość od jednego wiersza tekstu do drugiego | |
} | |
// zerujemy tytuły | |
h1, h2, h3, h4 { |