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
class Search | |
include Mongoid::Document | |
field :query, :type => Hash | |
field :collection | |
embedded_in :user | |
def to_criteria | |
Mongoid::Criteria.new( collection.titleize.constantize ).fuse( query ) |
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
Alabama: | |
- Autauga County | |
- Baldwin County | |
- Barbour County | |
- Bibb County | |
- Blount County | |
- Bullock County | |
- Butler County | |
- Calhoun County | |
- Chambers County |
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 '[datomic.api :as d]) | |
(def uri "datomic:mem://hello") | |
(d/create-database uri) | |
;; Define a transaction to create an attribute with type function (:some/fn) | |
(def attribute-tx [ {:db/id (d/tempid :db.part/db) | |
:db/ident :regular/attribute | |
:db/cardinality :db.cardinality/one |
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
; NUMBERS | |
(+ 5 5) | |
(* 5 5) | |
(/ 5 5) | |
(- 5 5) | |
(/ 2 3) | |
(/ 2.2 3.3) |
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
(let [a (System/nanoTime) | |
b (Thread/sleep 2301) | |
c (System/nanoTime)] | |
(.toMillis java.util.concurrent.TimeUnit/NANOSECONDS | |
(- c a))) ; => 2301 |
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 hello-world.core | |
(:require [org.httpkit.server :refer [run-server]] | |
[compojure.core :refer (GET defroutes)] | |
[compojure.route :as route] | |
[hiccup.core :refer (html)] | |
[hiccup.page :refer (html5)] | |
[ring.middleware.resource :refer (wrap-resource)] | |
[ring.middleware.file-info :refer (wrap-file-info)])) | |
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 example.runner | |
(:require [taoensso.timbre :as timbre]))) | |
(timbre/refer-timbre) | |
(defn run-service | |
"Apply each member of a collection to a function. | |
Collect and return simple profiling info, | |
success and failures." |
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 save-file | |
"Saves a file to dropbox | |
dropbox component | |
data spittable data to save | |
file-label keyword file label | |
file-ext keyword file extension" | |
[dropbox data file-label file-ext] | |
(let [file-label (name file-label) | |
file-ext (name file-ext) | |
now (java.util.Date.) |
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 box (atom nil)) | |
(def futures (atom nil)) | |
{:a "1" :b "2"} | |
[:a "1"] | |
[:b "2"] | |
(defn my-fn [{input-map :key some-var :a} name [x y z] ] |
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
;; in a cider repl | |
;; start system / webserver | |
(user/reset) | |
;; Start browser-connected repl | |
(require 'cljs.repl.browser) | |
(cemerick.piggieback/cljs-repl | |
:repl-env (cljs.repl.browser/repl-env :port 9000)) | |
;; Visit http://localhost:3000 in Chrome. |
OlderNewer