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 schema->gen | |
"Functions for generating test data from schemas." | |
(:require [four.stateful :as four] | |
[re-rand :refer [re-rand]] | |
[schema.core :as sch] | |
[simple-check.generators :as gen])) | |
(defn ^:private re-randify-regex | |
"schema requires ^$ while re-rand forbids them" | |
[re] |
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
(require '[clojure.test :as test]) | |
; Rewrite clojure.test to generate data structures instead of writing to | |
; stdout | |
(def ^:dynamic *results* | |
"Bound dynamically to an atom wrapping a vector of test report maps") | |
(defn add-name | |
"Given a testing report map, assoc's on a :name derived from the current | |
`clojure.test/testing` context." |
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
= P:Cubed Clojure Language Learning Resources = | |
(Taken from P-Cubed internal wiki. Public site = www.p-cubed.co.za) | |
Clojure is a dynamic programming language that targets the Java Virtual Machine (and the CLR, and JavaScript). | |
It is designed to be a general-purpose language, combining the approachability and interactive development of a scripting language with an efficient and robust infrastructure for multithreaded programming. | |
It also focusses a lot on handling concurrency elegantly. | |
Taster of the language: http://www.tryclj.com/ | |
While it's dynamically typed by default, it can be optionally statically typed using core.typed. |
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
/** | |
* Database.kt | |
*/ | |
import com.rethinkdb.RethinkDB | |
import com.rethinkdb.gen.ast.ReqlExpr | |
import com.rethinkdb.net.Connection | |
import com.rethinkdb.net.ConnectionInstance | |
object Database { | |
private lateinit var db: String |
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
require 'nokogiri' | |
# Public: Find the absolute path to a file | |
# | |
# This method finds a file that is relative to the | |
# location of the script, expanding anything that | |
# needs expanding (~, etc.) | |
# | |
# filename - the filename to find |
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
// nodewar.com library function… | |
// o.lib.targeting.simpleTarget(ship, pos) | |
// | |
// mostly deobfuscated/deminified | |
// | |
function simpleTarget(ship, pos) { | |
var i, r, h, | |
torque = 0, | |
thrust = 0, | |
dir = o.lib.targeting.dir(ship, pos); |
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
;;; Seed Dependencies for Clojure Projects | |
;; This file contains Leiningen-style dependencies for many | |
;; commonly-used Clojure and Java libraries. | |
;; If you put all of these dependencies in a project.clj file, you | |
;; will NOT get a working project! However, running `lein deps` will | |
;; download all of these libraries as well as their transitive | |
;; dependencies. This is a convenient way to "seed" the local Maven | |
;; repository cache on a new machine. |
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
(time | |
(def data-thread | |
(let [c (chan) | |
res (atom [])] | |
;; fetch em all | |
(doseq [i (range 10 100)] | |
(thread (>!! c (blocking-get (format "http://fssnip.net/%d" i))))) | |
;; gather results | |
(doseq [_ (range 10 100)] | |
(swap! res conj (<!! c))) |
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
;; Builds of Datomic with revision numbers higher than 0.1.3057 have | |
;; support for :db.type/fn, :db.type/bytes, and :db/fn. | |
;; To add these types to a database created using with a pre-0.1.3057 | |
;; build, simply run the database with a newer version of Datomic, and | |
;; execute the two transactions below. | |
[{:db/id #db/id [:db.part/db] | |
:db/ident :db.type/bytes | |
:fressian/tag :bytes |
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
(resource | |
{:id ::index | |
:methods | |
{:post | |
{:consumes "application/octet-stream" | |
:consumer (fn [ctx _ body-stream] | |
(let [f (java.io.File/createTempFile "yada" ".tmp" (io/file "/tmp"))] | |
(infof "Saving to file: %s" f) | |
(save-to-file | |
ctx body-stream |
OlderNewer