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
# My take on Mike's source_for method. | |
# (see http://pragmaticstudio.com/blog/2013/2/13/view-source-ruby-methods) | |
# | |
# (1) I named it 'src' rather than source_for (ok, I'm a lazy typer). | |
# (2) The edit function was broken out as a separate function. | |
# (3) The edit function is for emacs | |
# (4) If the method is not defined on the object, and the object | |
# is a class, then see if it is an instance method on the class. | |
# | |
# The fourth point allows my to say: |
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
;; Datomic example code | |
;; | |
;; The extent of entity ?x is all datoms that are about ?x. | |
;; Drop this into your rules. | |
;; | |
;; Demonstrates | |
;; | |
;; 1. recursive query (extent calls itself) | |
;; 2. disjunction (different extent bodies are ORed) | |
;; 3. component attributes (e.g. your arm is a component, your brother isn'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
{:user {:plugins [[lein-swank "1.4.5"] | |
;; [lein-pedantic "0.0.5"] | |
;; [lein-ritz "0.6.0"] | |
[lein-checkout-deps "1.0.0"] | |
;; [lein-haml-sass "0.2.4"] | |
[lein-midje "2.0.1"] | |
[lein-kibit "0.0.7"]]} | |
{:dependencies [[slamhound "1.3.0"]]} | |
{:aliases {"slamhound" ["run" "-m" "slam.hound"]}}} |
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 datomic-playground.core | |
(:require [datomic-simple.core :as ds])) | |
(def model-namespace :user) | |
(def schema | |
(ds/build-schema model-namespace | |
[[:username :string] | |
[:password :string]])) | |
(ds/create-model-fns model-namespace) |
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
;; It all started here: http://clojure-log.n01se.net/date/2011-04-06.html#19:04 | |
(#((% (+(*))) %) ;; call arg 1 with all args | |
[;; data | |
(+ (*)(*)(*)(*)(*)(*)(*)) | |
;; main fn -- simulate 'if' with map lookup and closures | |
#(({(+) (% (+(*)(*)))} ;; if zero return 'then' clause | |
(% (+)) ;; dispatch on first arg | |
(% (+(*)(*)(*)))) ;; call 'else' clause (n not found in 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
(ns getclojure.jail | |
(:require [clojail.core :as jail] | |
[clojail.testers :as tester] | |
[clojure.stacktrace :as trace]) | |
(:import [java.io StringWriter PushbackReader FileReader] | |
java.util.concurrent.TimeoutException)) | |
(defn truncate [x] | |
(if string? | |
(let [out (apply str (take 400 x))] |
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
$ cd path_to_datomic | |
$ ./bin/rest 8080 free datomic:free://localhost:4334/ | |
$ cd path_to_datomic | |
$ bin/transactor config/samples/free-transactor-template.properties | |
$ git clone codeq | |
$ cd codeq | |
$ lein uberjar | |
$ java -server -Xmx1g -jar ~/dev/codeq/target/codeq-0.1.0-SNAPSHOT-standalone.jar datomic:free://localhost:4334/codeq |
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 '[datomic.api :as d]) | |
(def uri "datomic:free://localhost:4334/git") | |
(def conn (d/connect uri)) | |
(def rules | |
'[[(node-files ?n ?f) [?n :node/object ?f] [?f :git/type :blob]] | |
[(node-files ?n ?f) [?n :node/object ?t] [?t :git/type :tree] | |
[?t :tree/nodes ?n2] (node-files ?n2 ?f)] | |
[(object-nodes ?o ?n) [?n :node/object ?o]] | |
[(object-nodes ?o ?n) [?n2 :node/object ?o] [?t :tree/nodes ?n2] (object-nodes ?t ?n)] | |
[(commit-files ?c ?f) [?c :commit/tree ?root] (node-files ?root ?f)] |
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
dev/blacklight master (solo)> ./test_support/bin/test.sh | |
Usage: | |
rails new APP_PATH [options] | |
Options: | |
-r, [--ruby=PATH] # Path to the Ruby binary of your choice | |
# Default: /Users/plato/.rvm/rubies/ruby-1.9.3-p194/bin/ruby | |
-b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL) | |
-m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL) | |
[--skip-gemfile] # Don't create a Gemfile |
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
dev/blacklight master (solo)> ./test_support/bin/test.sh | |
/Users/plato/.rvm/gems/ruby-1.9.3-p194@blacklight/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90:in `block in materialize': Could not find chunky_png-1.2.6 in any of the sources (Bundler::GemNotFound) | |
from /Users/plato/.rvm/gems/ruby-1.9.3-p194@blacklight/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `map!' | |
from /Users/plato/.rvm/gems/ruby-1.9.3-p194@blacklight/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `materialize' | |
from /Users/plato/.rvm/gems/ruby-1.9.3-p194@blacklight/gems/bundler-1.1.5/lib/bundler/definition.rb:127:in `specs' | |
from /Users/plato/.rvm/gems/ruby-1.9.3-p194@blacklight/gems/bundler-1.1.5/lib/bundler/environment.rb:27:in `specs' | |
from /Users/plato/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.2/lib/rubygems-bundler/noexec.rb:41:in `candidate?' | |
from /Users/plato/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-1.0.2/lib/rubygems-bundler/noexec.rb:60:in `setup' | |
from /Users/plato/.rvm/gems/ruby-1.9.3-p19 |