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
#include "stdafx.h" | |
#include <iostream> | |
#include <fstream> | |
#include <string> | |
#include <map> | |
#include <vector> | |
#include <algorithm> | |
// компаратор пары в нужном порядке |
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
# https://www.onlinegdb.com/online_python_interpreter# | |
''' | |
-- immutable, persistent, coinductive streams | |
ones = 1 : ones | |
fibs = 0 : 1 : zipWith (+) fibs (tail fibs) | |
hamm = 1 : map (*2) hamm `f` map (*3) hamm `f` map (*5) hamm where |
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
print("\n\n\n") | |
// волшебная троица | |
const cons = (x, y) => [x,y] | |
const car = (l) => l[0] | |
const cdr = (l) => l[1] | |
// scons(h, t) = cons(h, lz(() => t)) |
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
(do | |
(def ones | |
(lazy-seq (cons 1 ones))) | |
(prn (take 10 ones)) | |
(defn intfrom [n] | |
(lazy-seq (cons n (intfrom (+ 1 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
"""Minimal subnetwork.""" | |
def minSubNetMask(ips): | |
m = 0 | |
for ip in ips: m |= ips[0] ^ ip | |
full = (1 << 32) - 1 # 128 for IPv6 | |
return (full << m.bit_length()) & full | |
def tst(ips, res): | |
r = minSubNetMask(ips) == res |
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
"use strict"; | |
/////////////////////////////////////////////////////////////////////////////////////////////////////////// | |
// волшебная троица | |
const cons = (x, y) => [x,y] | |
const car = (l) => l[0] | |
const cdr = (l) => l[1] | |
const nil = cons(null, 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
(defn take-first-sorted-by | |
"Performs the same result as (take n (sort-by keyfn comp coll)) | |
but more efficient in terms of time and memory" | |
([n keyfn coll] (take-first-sorted-by n keyfn compare coll)) | |
([n keyfn ^java.util.Comparator comp coll] | |
(if (pos? n) | |
(let [m ^java.util.TreeMap (java.util.TreeMap. comp) | |
m-size (volatile! 0) | |
;; if it is guaranteed that (keyfn v) will be unique for all v in coll | |
;; we can attach :unique? key to keyfn meta and algorythm will use single val map |
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
create table organization ( | |
id int, | |
parent int, | |
name text | |
); | |
insert into organization (id, parent, name) | |
values (1, null, 'ГКБ 1') | |
,(2, null, 'ГКБ 2') | |
,(3, 1, 'Детское отделение') |
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
;; toast ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defn- create-element-from-hiccup [hiccup-data] | |
(let [tmp (.createElement js/document "div") | |
content (rds/render-to-static-markup hiccup-data)] | |
(aset tmp "innerHTML" content) | |
(.-firstChild tmp))) | |
(defn- get-create-toast-container [] | |
(let [container-id "ivana_toast_container"] |
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
.....................................................................................................................................................#########................................................................................................................................................. | |
.....................................................................................................................................................#*******#................................................................................................................................................. | |
.....................................................................................................................................................#*******#................................................................................................................................................. | |
................................................................................................................ |
OlderNewer