- id:integer
- title:string
- pages:integer
- cover:image
- weight:integer
- price:integer
- illustrations - модель (это что?)
- genres - модель (много)
- series - модель (одна)
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 Component { | |
render() { | |
const myFontSize = 10 | |
const className = 'test' | |
const text = 'Lorem ipsum' | |
return ` | |
<p | |
style="${CSS({ | |
fontSize: myFontSize, |
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
(ns hello-world.core | |
(:require [compojure.core :refer [defroutes GET]])) | |
(defroutes app | |
(GET "/hello/:name" [name] | |
(str "Hello " name "!"))) |
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
(ns ast.core | |
(:require [clojure.core.match :refer [match]] | |
[clojure.string :refer [join]])) | |
(defn ast->base [ast] | |
(match ast | |
[:number n] (str n) | |
[:string s] (str "\"" s "\""))) | |
(defn ast->js [ast] |
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
# initialization file (not found) |
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
#!/usr/bin/env boot | |
(require '[clojure.java.io :refer [reader]]) | |
(def filename "file.txt") | |
(with-open [rdr (reader filename)] | |
; line - первая строка, lines - остальные | |
(loop [[line & lines] (line-seq rdr) | |
radicals [] |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func now() int64 { | |
return time.Now().UnixNano() / int64(time.Millisecond) | |
} |
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
(ns app.core | |
(:require [clojure.string :refer [join trim]])) | |
(defn lazy? [x] | |
(instance? clojure.lang.LazySeq x)) | |
(defn attr-value->html [value] | |
(let [q "\""] | |
(cond | |
(keyword? value) (str q (name value) q) |
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 Order | |
# user | |
# status %i{ registration payment waiting_products waiting_preorder packing sending complete } | |
# wait_until_preorder bool - ждать для открыток? | |
def avaiable? | |
order_items.all? { |oi| oi.avaiable? } | |
end | |
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
const POPULATION_SIZE = 100 | |
class GeneticAlgorithm { | |
generate(length) { | |
let chromosome = '' | |
for (let i = 0; i < length; i += 1) { | |
chromosome += String(Number(Math.random(1) > 0.5)) | |
} | |