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 any? | |
(complement not-any?)) |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
(defmacro if-let* | |
([bindings then] | |
`(if-let* ~bindings ~then nil)) | |
([bindings then else] | |
(if (seq bindings) | |
`(if-let [~(first bindings) ~(second bindings)] | |
(if-let* ~(drop 2 bindings) ~then ~else) | |
~(if-not (second bindings) else)) | |
then))) |
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
(defmacro when-let* | |
([bindings & body] | |
(if (seq bindings) | |
`(when-let [~(first bindings) ~(second bindings)] | |
(when-let* ~(drop 2 bindings) ~@body)) | |
`(do ~@body)))) |
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 data [{:v 12, :a 10} {:v 21, :a 113} {:v 1, :a 2} {:v 12, :a 223} {:v 100, :a 23} {:v 1, :a 113}]) | |
(defn multi-comp | |
([fns a b] | |
(multi-comp fns < a b)) | |
([[f & others :as fns] order a b] | |
(if (seq fns) | |
(let [result (compare (f a) (f b)) | |
f-result (if (= order >) (* -1 result) result)] | |
(if (= 0 f-result) |
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 speed 750) | |
(def moving-frequency 15) | |
(defn scroll-to-id | |
[elem target-id] | |
(let [target (.getElementById js/document target-id) | |
elem-scroll-top (-> elem .-scrollTop) | |
hop-count (/ speed moving-frequency) | |
gap (/ (- (-> target .-offsetTop) elem-scroll-top) hop-count)] | |
(doseq [i (range 1 (inc hop-count))] |
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 find-index-route | |
[x form] | |
(letfn [(get-nodes [form] | |
(tree-seq coll? identity form)) | |
(get-tree [form] | |
(rest (get-nodes form))) | |
(get-level [form] | |
(if (or (not (coll? form)) (not (seq 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
(defmacro assert-all | |
[& pairs] | |
`(do (when-not ~(first pairs) | |
(throw (IllegalArgumentException. | |
(str (first ~'&form) " requires " ~(second pairs) " in " ~'*ns* ":" (:line (meta ~'&form)))))) | |
~(let [more (nnext pairs)] | |
(when more | |
(list* `assert-all more))))) | |
(defmacro when-let* |
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 soyisimler ( | |
id int IDENTITY(1,1) NOT NULL, | |
soyisim varchar(255) NOT NULL, | |
PRIMARY KEY (id) | |
) | |
INSERT INTO soyisimler VALUES ('ABAT'); | |
INSERT INTO soyisimler VALUES ('ABSEYİ'); | |
INSERT INTO soyisimler VALUES ('ABACIOĞLU'); | |
INSERT INTO soyisimler VALUES ('ACAR'); |
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
-- Turkce isimler sozlugu twitter : http://twitter.com/tserpico | |
CREATE TABLE `isimler` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`isimler` varchar(255) DEFAULT NULL, | |
`cinsiyet` varchar(255) DEFAULT NULL COMMENT 'erkek : E , kadın : K , uniseks : U', | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB; | |
-- ---------------------------- |
OlderNewer