This file contains hidden or 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 chess-gm.pgn-test | |
| (:require [clojure.test :refer :all] | |
| [orchestra.spec.test :as stest] | |
| [clojure.spec.alpha :as s] | |
| [chess-gm.pgn :as sut])) | |
| (deftest basic-SAN | |
| (testing "a simple vertical move should be valid" | |
| (let [white-king-pawn-two-steps (seq "e4")] | |
| (is (s/valid? ::sut/basic-move white-king-pawn-two-steps)))) |
This file contains hidden or 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 chess-gm.pgn | |
| "See https://opensource.apple.com/source/Chess/Chess-110.0.6/Documentation/PGN-Standard.txt | |
| and https://en.wikipedia.org/wiki/Portable_Game_Notation for more details on specification" | |
| (:require [clojure.spec.alpha :as s])) | |
| (s/def ::column-index (set "abcdefgh")) | |
| (s/def ::row-index (set "12345678")) | |
| (s/def ::piece-name (set "QKWBNRP")) |
This file contains hidden or 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 prime | |
| (:require [clojure.spec.alpha :as s])) | |
| (s/def ::prime-number | |
| (fn [x] | |
| (cond (<= x 1) false | |
| (= 2 x) true | |
| :else | |
| (let [naturals (drop 2 (map inc (range))) |
This file contains hidden or 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 genLongString = (url) => { | |
| // doesn't actually use the url | |
| let chars = []; | |
| const bigNum = Math.floor(Math.random() * 1000000 + 1000000); | |
| for (let i = 0; i <= bigNum; i += 1) { chars.push('x'); } | |
| const longString = chars.join(''); | |
| return longString; | |
| }; | |
| const getLargeExternalData = (url, retn) => { |
This file contains hidden or 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 saved_dependencies_ddl | |
| ( | |
| deps_id serial primary key, | |
| deps_view_schema varchar(255), | |
| deps_view_name varchar(255), | |
| dependency_name varchar(255), | |
| deps_ddl_to_run text | |
| ); | |
| create or replace function save_and_drop_dependencies(p_view_schema varchar, p_view_name varchar) returns void as |
This file contains hidden or 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 djtango.write-date | |
| "Serialising/deserialsing mixed Clojure/JodaTime data.") | |
| ;; I made use of the advice at http://proofbyexample.com/print-and-read-in-clojure.html | |
| ;; in writing this file. | |
| ;; Make it possible to print joda DateTime instances in re-readable form, for persistence. | |
| (defmethod print-dup org.joda.time.DateTime | |
| [dt out] | |
| (.write out (str "#=" `(org.joda.time.DateTime. ~(.getMillis dt) ~org.joda.time.DateTimeZone/UTC)))) |
NewerOlder