Skip to content

Instantly share code, notes, and snippets.

View kana-sama's full-sized avatar
🌚

kana kana-sama

🌚
View GitHub Profile

Product:

  • id:integer
  • title:string
  • pages:integer
  • cover:image
  • weight:integer
  • price:integer
  • illustrations - модель (это что?)
  • genres - модель (много)
  • series - модель (одна)
class Component {
render() {
const myFontSize = 10
const className = 'test'
const text = 'Lorem ipsum'
return `
<p
style="${CSS({
fontSize: myFontSize,
@kana-sama
kana-sama / [ clojure + compojure ].clj
Last active October 14, 2016 10:48
hello-worlds bakends on different stacks
(ns hello-world.core
(:require [compojure.core :refer [defroutes GET]]))
(defroutes app
(GET "/hello/:name" [name]
(str "Hello " name "!")))
(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]
# initialization file (not found)
#!/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 []
package main
import (
"fmt"
"time"
)
func now() int64 {
return time.Now().UnixNano() / int64(time.Millisecond)
}
@kana-sama
kana-sama / core.clj
Last active November 6, 2016 22:31
hiccup-like dsl for html (clojure)
(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)
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
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))
}