i " вставить текст до курсора
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
FROM hexlet/hexlet-base | |
RUN apt-install python-pip python-dev | |
RUN apt-install python3-pip python3-dev | |
RUN pip3 install pytest | |
ENV PYTHONDONTWRITEBYTECODE 1 |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
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 factorial [n] | |
(let [y (fn [f] (f f)) | |
f (fn [g] (fn [n] (if (zero? n) 1 (* n ((g g) (dec n))))))] | |
((y f) n))) |
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
require 'dry-validation' | |
class EnvValidation | |
class ENV | |
def inspect | |
ivs = instance_variables.each { |v| "#{v}=#{instance_variable_get(v)}" }.join(', ') | |
"ENV[#{ivs}]" | |
end | |
def to_s |
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
;; ; made this macro scraching my head between the simplicity of Haskell for fix | |
;; ; and the absence of curryfication in Clojure. | |
;; (P expr-fn) ; makes expr-fn lazy | |
;; (P P expr-fn) ; curry one time expr-fn | |
;; (P P P expr-fn) ; curry two time expr-fn | |
;; (= ((((P P P str) "a") "b") "c") "abc") ;=> true | |
(defmacro P [& f] | |
(let [x (gensym 'x)] ;; cannot be replaced by x# due to nested macro expansion. |
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
class Jobs < ROM::Relation[:sql] | |
schema(:jobs) do | |
# ... | |
associations do | |
belongs_to :team | |
belongs_to :template | |
belongs_to :address | |
belongs_to :client | |
end |
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
/** | |
* @brief executeQueriesFromFile Read each line from a .sql QFile | |
* (assumed to not have been opened before this function), and when ; is reached, execute | |
* the SQL gathered until then on the query object. Then do this until a COMMIT SQL | |
* statement is found. In other words, this function assumes each file is a single | |
* SQL transaction, ending with a COMMIT line. | |
*/ | |
void executeQueriesFromFile(QFile *file, QSqlQuery *query) | |
{ |
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
list: | |
- name: Adobe Systems | |
name2: Adobe Systems Inc. | |
url: http://www.adobe.com | |
symbol: ADBE | |
price: 39.26 | |
change: 0.13 | |
ratio: 0.33 | |
- name: Advanced Micro Devices | |
name2: Advanced Micro Devices Inc. |
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
#%RAML 0.8 | |
title: World Music API | |
baseUri: http://example.api.com/{version} | |
version: v1 | |
schemas: | |
- halLink: | | |
{ "$schema": "http://json-schema.org/schema", | |
"type": "object", | |
"description": "a Hypertext Application Language link", |
OlderNewer