Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Complete lazy sequences koans test | (meditations
"There is a wide range of ways to generate a sequence"
(= __ (range 1 5))
"The range starts at the beginning by default"
(= __ (range 5))
"It's important to only take what you need from a big sequence"
(= [0 1 2 3 4 5 6 7 8 9]
(take __ (range 100)))
"You can also limit results by dropping what you don't need"
(= [95 96 97 98 99]
(drop __ (range 100)))
"Iteration provides an infinite lazy sequence"
(= __ (take 20 (iterate inc 0)))
"Repetition is key"
(= [:a :a :a :a :a :a :a :a :a :a ]
(repeat 10 __))
"Iteration can be used for repetition"
(= (repeat 100 :foo)
(take 100 (iterate ___ :foo))))
| (meditations
"There is a wide range of ways to generate a sequence"
(= '(1 2 3 4) (range 1 5))
"The range starts at the beginning by default"
(= '(0 1 2 3 4) (range 5))
"It's important to only take what you need from a big sequence"
(= [0 1 2 3 4 5 6 7 8 9]
(take 10 (range 100)))
"You can also limit results by dropping what you don't need"
(= [95 96 97 98 99]
(drop 95 (range 100)))
"Iteration provides an infinite lazy sequence"
(= (range 0 20) (take 20 (iterate inc 0)))
"Repetition is key"
(= [:a :a :a :a :a :a :a :a :a :a ]
(repeat 10 :a))
"Iteration can be used for repetition"
(= (repeat 100 :foo)
(take 100 (iterate identity :foo))))
|
Add clojure 1.8 to the test suite. | {:dev
{:aliases {"test-all" ["with-profile" "dev,1.7:dev" "test"]}
:dependencies [[com.nimbusds/nimbus-jose-jwt "4.13.1"]]
:codeina {:sources ["src"]
:reader :clojure
:target "doc/dist/latest/api"
:src-uri "http://github.com/funcool/buddy-core/blob/master/"
:src-uri-prefix "#L"}
:plugins [[funcool/codeina "0.4.0"]
[lein-ancient "0.6.10"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}
| {:dev
{:aliases {"test-all" ["with-profile" "dev,1.7:dev,1.8:dev" "test"]}
:dependencies [[com.nimbusds/nimbus-jose-jwt "4.13.1"]]
:codeina {:sources ["src"]
:reader :clojure
:target "doc/dist/latest/api"
:src-uri "http://github.com/funcool/buddy-core/blob/master/"
:src-uri-prefix "#L"}
:plugins [[funcool/codeina "0.4.0"]
[lein-ancient "0.6.10"]]}
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}}
|
Change permission of nrepl port file | (ns clj-center.core
(:require [clojure.java.io :as io]
[clojure.tools.logging :as log]
[clojure.tools.nrepl.server :refer [start-server]])
(:gen-class))
(def ^:dynamic *nrepl-file*
(io/file (System/getProperty "user.home") ".clj-center-nrepl-port"))
(defn -main []
(let [nrepl-file (io/file *nrepl-file*)
nrepl-file-str (str *nrepl-file*)
_ (when (.exists nrepl-file)
(throw (RuntimeException. (str "file already exists: "
nrepl-file-str))))
server (start-server)]
(log/debug server)
(spit nrepl-file (:port server))
(log/info "write nrepl port info to file: " nrepl-file-str)
(.deleteOnExit nrepl-file)))
| (ns clj-center.core
(:require [clojure.java.io :as io]
[clojure.tools.logging :as log]
[clojure.tools.nrepl.server :refer [start-server]])
(:import (java.nio.file Files attribute.PosixFilePermission))
(:gen-class))
(def ^:dynamic *nrepl-file*
(io/file (System/getProperty "user.home") ".clj-center-nrepl-port"))
(defn -main []
(let [nrepl-file (io/file *nrepl-file*)
nrepl-file-str (str *nrepl-file*)
_ (when (.exists nrepl-file)
(throw (RuntimeException. (str "file already exists: "
nrepl-file-str))))
server (start-server)]
(log/debug server)
(spit nrepl-file (:port server))
(try
(Files/setPosixFilePermissions (.toPath nrepl-file)
#{PosixFilePermission/OWNER_READ
PosixFilePermission/OWNER_WRITE})
(catch UnsupportedOperationException _))
(log/info "write nrepl port info to file: " nrepl-file-str)
(.deleteOnExit nrepl-file)))
|
Use the 0.1.0 of guten-tag | (defproject org.clojure-grimoire/lib-grimoire "0.9.1"
:description "A shared library for Grimoire infrastructure"
:url "http://github.com/clojure-grimoire/lib-grimoire"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[version-clj "0.1.0"
:exclusions [org.clojure/clojure]]
[me.arrdem/guten-tag "0.1.0-SNAPSHOT"
:exclusions [org.clojure/clojure]]
[org.clojure/core.match "0.3.0-alpha4"
:exclusions [org.clojure/clojure]]
[com.cemerick/url "0.1.1"
:exclusions [com.cemerick/clojurescript.test
org.clojure/clojure]]]
:profiles {:dev {:dependencies [[org.clojure/test.check "0.6.1"
:exclusions [org.clojure/clojure]]]}})
| (defproject org.clojure-grimoire/lib-grimoire "0.9.1"
:description "A shared library for Grimoire infrastructure"
:url "http://github.com/clojure-grimoire/lib-grimoire"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[version-clj "0.1.0"
:exclusions [org.clojure/clojure]]
[me.arrdem/guten-tag "0.1.0"
:exclusions [org.clojure/clojure]]
[org.clojure/core.match "0.3.0-alpha4"
:exclusions [org.clojure/clojure]]
[com.cemerick/url "0.1.1"
:exclusions [com.cemerick/clojurescript.test
org.clojure/clojure]]]
:profiles {:dev {:dependencies [[org.clojure/test.check "0.6.1"
:exclusions [org.clojure/clojure]]]}})
|
Add some compojure and ring for good measure | (defproject trotter "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[com.palletops/pallet "0.8.0-RC.9"]
[com.palletops/pallet-jclouds "1.7.3"]
[org.apache.jclouds.provider/rackspace-cloudservers-us "1.8.0"]]
:profiles {:dev {:plugins [[com.palletops/pallet-lein "0.8.0-alpha.1"]]}})
| (defproject trotter "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[com.palletops/pallet "0.8.0-RC.9"]
[com.palletops/pallet-jclouds "1.7.3"]
[org.apache.jclouds.provider/rackspace-cloudservers-us "1.8.0"]
[compojure "1.1.8"]
[ring/ring-core "1.3.0"]
[ring/ring-jetty-adapter "1.3.0"]
[ring/ring-json "0.3.1"]]
:profiles {:dev {:plugins [[com.palletops/pallet-lein "0.8.0-alpha.1"]]}})
|
Make sure that the clojure source is included | (defproject fault "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:profiles {:dev {:dependencies [[junit/junit "4.11"]
[org.mockito/mockito-core "1.10.8"]]
:junit ["test/java"]
:java-source-paths ["src/java" "test/java"]
:plugins [[lein-junit "1.1.3"]]
:junit-formatter "brief"}}
:javac-target "1.7"
:dependencies [[org.clojure/clojure "1.6.0"]
[criterium "0.4.3"]]
:java-source-paths ["src/java"])
| (defproject fault "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:profiles {:dev {:dependencies [[junit/junit "4.11"]
[org.mockito/mockito-core "1.10.8"]]
:junit ["test/java"]
:java-source-paths ["src/java" "test/java"]
:plugins [[lein-junit "1.1.3"]]
:junit-formatter "brief"}}
:javac-target "1.7"
:dependencies [[org.clojure/clojure "1.6.0"]
[criterium "0.4.3"]]
:source-paths ["src/clojure"]
:java-source-paths ["src/java"])
|
Update to latest difform. Add clojure 1.2 as a dev dependency. | (defproject lein-difftest "1.3.2-SNAPSHOT"
:description "Run tests, display better test results."
:dependencies [[org.clojars.brenton/difform "1.1.0"]
[clj-stacktrace "0.2.0" :exclusions [org.clojure/clojure]]
[clansi "1.0.0"]]
:hooks [leiningen.hooks.difftest]
:test-path "test-fail")
| (defproject lein-difftest "1.3.2-SNAPSHOT"
:description "Run tests, display better test results."
:dependencies [[org.clojars.brenton/difform "1.1.1"]
[clj-stacktrace "0.2.0" :exclusions [org.clojure/clojure]]
[clansi "1.0.0" :exclusions [org.clojure/clojure]]]
:dev-dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]]
:hooks [leiningen.hooks.difftest]
:test-path "test-fail")
|
Prepare for next release cycle. | (defproject org.onyxplatform/onyx-metrics "0.8.0.3"
:description "Instrument Onyx workflows"
:url "https://github.com/MichaelDrogalis/onyx"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:dependencies [[org.clojure/clojure "1.7.0"]
[interval-metrics "1.0.0"]
[stylefruits/gniazdo "0.4.0"]]
:java-opts ^:replace ["-server" "-Xmx3g"]
:global-vars {*warn-on-reflection* true
*assert* false
*unchecked-math* :warn-on-boxed}
:profiles {:dev {:dependencies [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
[org.onyxplatform/onyx "0.8.0"]
[riemann-clojure-client "0.4.1"]]
:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}})
| (defproject org.onyxplatform/onyx-metrics "0.8.0.4-SNAPSHOT"
:description "Instrument Onyx workflows"
:url "https://github.com/MichaelDrogalis/onyx"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:dependencies [[org.clojure/clojure "1.7.0"]
[interval-metrics "1.0.0"]
[stylefruits/gniazdo "0.4.0"]]
:java-opts ^:replace ["-server" "-Xmx3g"]
:global-vars {*warn-on-reflection* true
*assert* false
*unchecked-math* :warn-on-boxed}
:profiles {:dev {:dependencies [^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
[org.onyxplatform/onyx "0.8.0"]
[riemann-clojure-client "0.4.1"]]
:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}})
|
Use Seesaw 1.4.0. No more SNAPSHOT for the time being. | (defproject overtone "0.7.0-SNAPSHOT"
:description "Programmable Music."
:url "http://project-overtone.org"
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/core.incubator "0.1.0"]
[org.clojure/data.json "0.1.2"]
[overtone/scsynth-jna "0.1.2-SNAPSHOT"]
[overtone/at-at "0.2.1"]
[overtone/osc-clj "0.7.1"]
[overtone/byte-spec "0.3.1"]
[overtone/midi-clj "0.2.1"]
[clj-glob "1.0.0"]
[org.clojure/core.match "0.2.0-alpha6"]
[seesaw "1.3.1-SNAPSHOT"]]
:jvm-opts ["-Xms256m" "-Xmx1g" "-XX:+UseConcMarkSweepGC"])
| (defproject overtone "0.7.0-SNAPSHOT"
:description "Programmable Music."
:url "http://project-overtone.org"
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/core.incubator "0.1.0"]
[org.clojure/data.json "0.1.2"]
[overtone/scsynth-jna "0.1.2-SNAPSHOT"]
[overtone/at-at "0.2.1"]
[overtone/osc-clj "0.7.1"]
[overtone/byte-spec "0.3.1"]
[overtone/midi-clj "0.2.1"]
[clj-glob "1.0.0"]
[org.clojure/core.match "0.2.0-alpha6"]
[seesaw "1.4.0"]]
:jvm-opts ["-Xms256m" "-Xmx1g" "-XX:+UseConcMarkSweepGC"])
|
Fix my radagast pattern & bump dep versions | (defproject me.arrdem/oxcart (slurp "VERSION")
:description "An experimental optimizing compiler for Clojure code"
:url "http://github.com/arrdem/oxcart"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [
[org.clojure/clojure "1.5.1"]
[org.clojure/tools.analyzer "0.2.2"]
[org.clojure/tools.analyzer.jvm "0.2.2"]
[org.clojure/tools.emitter.jvm "0.0.1-SNAPSHOT"]
[org.clojure/tools.reader "0.8.5"]
[com.taoensso/timbre "3.2.1"]
]
:injections [(set! *print-length* 10)
(set! *print-level* 10)])
| (defproject me.arrdem/oxcart (slurp "VERSION")
:description "An experimental optimizing compiler for Clojure code"
:url "http://github.com/arrdem/oxcart"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [
[org.clojure/clojure "1.5.1"]
[org.clojure/tools.analyzer "0.2.3"]
[org.clojure/tools.analyzer.jvm "0.2.2"]
[org.clojure/tools.emitter.jvm "0.0.1-SNAPSHOT"]
[org.clojure/tools.reader "0.8.5"]
[com.taoensso/timbre "3.2.1"]
]
:whitelist #"oxcart"
:injections [(set! *print-length* 10)
(set! *print-level* 10)])
|
Adjust stefon and http-kit versions. | (defproject incise "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[speclj "2.1.2"]
[ring "1.2.0"]
[hiccup "1.0.2"]
[compojure "1.1.5"]
[http-kit "2.1.1"]
[robert/hooke "1.3.0"]
[me.raynes/cegdown "0.1.0"]
[org.clojure/java.classpath "0.2.0"]
[org.clojure/tools.namespace "0.2.4"]
[org.clojure/tools.cli "0.2.4"]
[clj-time "0.5.1"]
[com.taoensso/timbre "2.6.1"]
[com.ryanmcg/stefon "0.5.1"]]
:profiles {:dev {:dependencies [[speclj "2.5.0"]]}}
:plugins [[speclj "2.5.0"]]
:test-paths ["spec/"]
:main incise.core)
| (defproject incise "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[speclj "2.1.2"]
[ring "1.2.0"]
[hiccup "1.0.2"]
[compojure "1.1.5"]
[http-kit "2.1.10"]
[robert/hooke "1.3.0"]
[me.raynes/cegdown "0.1.0"]
[org.clojure/java.classpath "0.2.0"]
[org.clojure/tools.namespace "0.2.4"]
[org.clojure/tools.cli "0.2.4"]
[clj-time "0.5.1"]
[com.taoensso/timbre "2.6.1"]
[com.ryanmcg/stefon "0.5.0"]]
:profiles {:dev {:dependencies [[speclj "2.5.0"]]}}
:plugins [[speclj "2.5.0"]]
:test-paths ["spec/"]
:main incise.core)
|
Add line between defscreen functions | (ns {{namespace}}
(:require [play-clj.core :refer :all]
[play-clj.ui :refer :all]))
(defscreen main-screen
:on-show
(fn [screen entities]
(update! screen :renderer (stage))
(label "Hello world!" (color :white)))
:on-render
(fn [screen entities]
(clear!)
(render! screen entities)))
(defgame {{app-name}}
:on-create
(fn [this]
(set-screen! this main-screen)))
| (ns {{namespace}}
(:require [play-clj.core :refer :all]
[play-clj.ui :refer :all]))
(defscreen main-screen
:on-show
(fn [screen entities]
(update! screen :renderer (stage))
(label "Hello world!" (color :white)))
:on-render
(fn [screen entities]
(clear!)
(render! screen entities)))
(defgame {{app-name}}
:on-create
(fn [this]
(set-screen! this main-screen)))
|
Allow lookup by ServiceName or String | ;; Copyright 2008-2011 Red Hat, Inc, and individual contributors.
;;
;; This is free software; you can redistribute it and/or modify it
;; under the terms of the GNU Lesser General Public License as
;; published by the Free Software Foundation; either version 2.1 of
;; the License, or (at your option) any later version.
;;
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Lesser General Public License for more details.
;;
;; You should have received a copy of the GNU Lesser General Public
;; License along with this software; if not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301 USA, or see the FSF site: http://www.fsf.org.
(ns immutant.registry
(:import (org.jboss.msc.service ServiceName)))
(def registry nil)
(defn set-registry [v]
(def registry v))
(defn service [name]
(if registry
(let [key (ServiceName/parse name)
value (.getService registry key)]
(and value (.getValue value)))))
| ;; Copyright 2008-2011 Red Hat, Inc, and individual contributors.
;;
;; This is free software; you can redistribute it and/or modify it
;; under the terms of the GNU Lesser General Public License as
;; published by the Free Software Foundation; either version 2.1 of
;; the License, or (at your option) any later version.
;;
;; This software is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; Lesser General Public License for more details.
;;
;; You should have received a copy of the GNU Lesser General Public
;; License along with this software; if not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301 USA, or see the FSF site: http://www.fsf.org.
(ns immutant.registry
(:import (org.jboss.msc.service ServiceName)))
(def registry nil)
(defn set-registry [v]
(def registry v))
(defn service [name]
(if registry
(let [key (if (string? name) (ServiceName/parse name) name)
value (.getService registry key)]
(and value (.getValue value)))))
|
Improve debug utils as per @michaelklishin ocmment | (ns clojurewerkz.cassaforte.debug-utils
(:use clojure.stacktrace))
(defmacro output-debug
"Prints debugging statements out."
[q]
`(do
(println "Built query: " ~q)
~q))
(defmacro catch-exceptions
"Catches driver exceptions and outputs stacktrace."
[& forms]
`(try
(do ~@forms)
(catch com.datastax.driver.core.exceptions.DriverException ire#
(println (print-stack-trace ire# 5))
(println "Error came from server:" (.getMessage ire#)))))
| (ns clojurewerkz.cassaforte.debug-utils
(:use clojure.stacktrace))
(defmacro output-debug
"Prints debugging statements out."
[q]
`(do
(println "Built query: " ~q)
~q))
(defmacro catch-exceptions
"Catches driver exceptions and outputs stacktrace."
[& forms]
`(try
(do ~@forms)
(catch com.datastax.driver.core.exceptions.DriverException ire#
(println (.getMessage ire#))
(print-cause-trace ire#))))
|
Add :java-only to Java game template | (defproject {{app-name}} "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[com.badlogicgames.gdx/gdx "0.9.9-SNAPSHOT"]
[com.badlogicgames.gdx/gdx-backend-robovm "0.9.9-SNAPSHOT"]]
:repositories [["sonatype"
"https://oss.sonatype.org/content/repositories/snapshots/"]]
:java-source-paths ["src" "../desktop/src-common"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:ios {:robovm-opts ["-libs" "libs/libObjectAL.a:libs/libgdx.a"
"-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation"
"-resources" "../desktop/resources/**"]}
:aot :all
:main {{ios-namespace}})
| (defproject {{app-name}} "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[com.badlogicgames.gdx/gdx "0.9.9-SNAPSHOT"]
[com.badlogicgames.gdx/gdx-backend-robovm "0.9.9-SNAPSHOT"]]
:repositories [["sonatype"
"https://oss.sonatype.org/content/repositories/snapshots/"]]
:java-source-paths ["src" "../desktop/src-common"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:java-only true
:ios {:robovm-opts ["-libs" "libs/libObjectAL.a:libs/libgdx.a"
"-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation"
"-resources" "../desktop/resources/**"]}
:aot :all
:main {{ios-namespace}})
|
Make SIGHUP restart the system and SIGTERM stop it | (ns clstreams.core
(:gen-class)
(:require [clojure.tools.logging :as log]
[com.stuartsierra.component :as component]
[signal.handler :as signal]
[clstreams.pipelines]))
(defn run-system
[system]
(let [system-state (atom system)
stop? (promise)]
(signal/with-handler :int
(log/info "Received SIGINT")
(deliver stop? true))
(swap! system-state component/start)
(log/info "Topology initialized successfully")
@stop?
(log/info "Stopping topology")
(swap! system-state component/stop)
(log/info "Topology stopped")
(System/exit 0)))
(defn -main
[func-name]
(let [system (eval (symbol func-name))]
(run-system system)))
| (ns clstreams.core
(:gen-class)
(:require [clojure.tools.logging :as log]
[com.stuartsierra.component :as component]
[signal.handler :as signal]
[clstreams.pipelines]))
(defn run-system
[system-state-var]
(let [next-step (promise)
orig-handlers
(->
{}
(into (for [sgn [:term :int]]
[sgn
(signal/with-handler sgn
(log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
(deliver next-step :end))]))
(into (for [sgn [:hup]]
[sgn
(signal/with-handler sgn
(log/debugf "Received SIG%s" (-> sgn name .toUpperCase))
(deliver next-step :restart))])))]
(log/info "Starting topology")
(alter-var-root system-state-var component/start)
(let [ns @next-step]
(doseq [[sgn orig-handler] orig-handlers]
(sun.misc.Signal/handle (signal/->signal :int) orig-handler))
(log/info "Stopping topology")
(alter-var-root system-state-var component/stop)
(case ns
:end (System/exit 0)
:restart (recur system-state-var)))))
(defn -main
[func-name]
(def system-state (eval (symbol func-name)))
(run-system #'system-state))
|
Rename functions to how the catalogs are named | (ns catalog.core
(:require [catalog.layout
[dtbook :as layout.dtbook]
[fop :as layout.fop]]
[catalog.vubis :as vubis]
[clojure.java.io :as io]))
(defn neu-im-sortiment [in out]
(-> in
vubis/read-file
vubis/order-and-group
(layout.fop/document :all-formats)
(layout.fop/generate-pdf! out)))
(defn neue-grossdruckbücher [in out]
(-> in
vubis/read-file
vubis/order-and-group
(layout.fop/document :grossdruck)
(layout.fop/generate-pdf! out)))
(defn neue-hörbücher [in out]
(-> in
vubis/read-file
vubis/order-and-group
(layout.fop/document :hörbuch)
(layout.fop/generate-pdf! out)))
(defn neue-braillebücher [in out]
(->> in
vubis/read-file
vubis/order-and-group
:braille
layout.dtbook/dtbook
(spit (io/file out))))
| (ns catalog.core
(:require [catalog.layout
[dtbook :as layout.dtbook]
[fop :as layout.fop]]
[catalog.vubis :as vubis]
[clojure.java.io :as io]))
(defn neu-im-sortiment [in out]
(-> in
vubis/read-file
vubis/order-and-group
(layout.fop/document :all-formats)
(layout.fop/generate-pdf! out)))
(defn neu-in-grossdruck [in out]
(-> in
vubis/read-file
vubis/order-and-group
(layout.fop/document :grossdruck)
(layout.fop/generate-pdf! out)))
(defn neu-als-hörbuch [in out]
(-> in
vubis/read-file
vubis/order-and-group
(layout.fop/document :hörbuch)
(layout.fop/generate-pdf! out)))
(defn neu-in-braille [in out]
(->> in
vubis/read-file
vubis/order-and-group
:braille
layout.dtbook/dtbook
(spit (io/file out))))
|
Add a help message for --help | (ns desdemona.launcher.aeron-media-driver
(:gen-class)
(:require [clojure.core.async :refer [chan <!!]]
[clojure.tools.cli :refer [parse-opts]])
(:import [uk.co.real_logic.aeron Aeron$Context]
[uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context]))
(def cli-options
["-h" "--help"]])
[["-d" "--delete-dirs"
"Delete the media drivers directory on startup"
:default false]
(defn -main [& args]
(let [opts (parse-opts args cli-options)
{:keys [help delete-dirs]} (:options opts)
ctx (cond-> (MediaDriver$Context.)
delete-dirs (.dirsDeleteOnStart delete-dirs))
media-driver (try (MediaDriver/launch ctx)
(catch IllegalStateException ise
(throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
(when help
(run! (fn [opt]
(println (clojure.string/join " " (take 3 opt))))
cli-options)
(System/exit 0))
(println "Launched the Media Driver. Blocking forever...")
(<!! (chan))))
| (ns desdemona.launcher.aeron-media-driver
(:gen-class)
(:require [clojure.core.async :refer [chan <!!]]
[clojure.tools.cli :refer [parse-opts]])
(:import [uk.co.real_logic.aeron Aeron$Context]
[uk.co.real_logic.aeron.driver MediaDriver MediaDriver$Context]))
(def cli-options
[["-d" "--delete-dirs"
"Delete the media drivers directory on startup"
:default false]
["-h" "--help"
"Display a help message"]])
(defn -main [& args]
(let [opts (parse-opts args cli-options)
{:keys [help delete-dirs]} (:options opts)
ctx (cond-> (MediaDriver$Context.)
delete-dirs (.dirsDeleteOnStart delete-dirs))
media-driver (try (MediaDriver/launch ctx)
(catch IllegalStateException ise
(throw (Exception. "Error starting media driver. This may be due to a media driver data incompatibility between versions. Check that no other media driver has been started and then use -d to delete the directory on startup" ise))))]
(when help
(run! (fn [opt]
(println (clojure.string/join " " (take 3 opt))))
cli-options)
(System/exit 0))
(println "Launched the Media Driver. Blocking forever...")
(<!! (chan))))
|
Remove comment and add SPScrapeTripReport to get-implementation. | (ns scrape-trs.core
(:require [scrape-trs.cascade-climbers.core :as cc]))
(comment
"TODO:
- add SPScrapeTripReport
- upgrade get-trip-reports to return [errors, trip-reports]
based on try-slurp that returns [error, contents]
- add docs and tests for get-trip-reports
- implement save-trip-reports!
- make scrape-wa-trs project that
retrieves cc.com tr list pages for each region in WA (POST)
retrieves sp.com tr list page for WA
get-trip-reports on each page and concat all together
save to csv"
(def cascade-climbers-washington-regions
#{"Alpine Lakes"
"Central/Eastern Washington"
"Columbia River Gorge"
"Ice Climbing Forum"
"Mount Rainier NP"
"North Cascades"
"Olympic Peninsula"
"Rock Climbing Forum"
"Southern WA Cascades"
"the *freshiezone*"}))
(defn get-implementation
[url]
(let [base-url (re-find #"https?://.*?/" url)]
(condp = base-url
cc/base-url (cc/->CCScrapeTripReport))))
(defn get-trip-reports
""
[implementation list-page]
(let [pager-urls (.extract-pager-urls implementation list-page)
list-pages (if pager-urls (map slurp pager-urls) [list-page])
trip-report-urls (mapcat #(.extract-trip-report-urls implementation %)
list-pages)
trip-reports (map #(.extract-trip-report implementation %1 %2)
trip-report-urls
(map slurp trip-report-urls))]
trip-reports))
(defn save-trip-reports!
""
[f trip-reports])
| (ns scrape-trs.core
(:require [scrape-trs.cascade-climbers.core :as cc]
[scrape-trs.summitpost.core :as sp]))
(defn get-implementation
[url]
(let [base-url (re-find #"https?://.*?/" url)]
(condp = base-url
cc/base-url (cc/->CCScrapeTripReport)
sp/base-url (sp/->SPScrapeTripReport))))
(defn get-trip-reports
""
[implementation list-page]
(let [pager-urls (.extract-pager-urls implementation list-page)
list-pages (if pager-urls (map slurp pager-urls) [list-page])
trip-report-urls (mapcat #(.extract-trip-report-urls implementation %)
list-pages)
trip-reports (map #(.extract-trip-report implementation %1 %2)
trip-report-urls
(map slurp trip-report-urls))]
trip-reports))
(defn save-trip-reports!
""
[f trip-reports])
|
Create ".nrepl-port" file instead of "repl-port" | (ns leiningen.droid.compatibility
"Contains utilities for letting lein-droid to cooperate with
ant/Eclipse build tools."
(:require [clojure.java.io :as io])
(:use [leiningen.core
[main :only [info]]
[classpath :only [resolve-dependencies]]]
[leiningen.droid.utils :only [ensure-paths]]))
(defn gather-dependencies
"Compatibility task. Copies the dependency libraries into the libs/ folder."
[{:keys [root] :as project} & {dir ":dir", :or {dir "libs"} :as other}]
(println (class (first (keys other))))
(info "Copying dependency libraries into" (str dir "..."))
(let [destination-dir (io/file root dir)
dependencies (resolve-dependencies :dependencies project)]
(.mkdirs destination-dir)
(doseq [dep dependencies]
(io/copy dep
(io/file destination-dir (.getName ^java.io.File dep))))))
(defn create-repl-port-file
"Creates a file named `repl-port` in target directory with port
number inside, so fireplace.vim can connect to the REPL."
[{{:keys [repl-local-port]} :android, target-path :target-path :as project}]
(ensure-paths target-path)
(spit (io/file target-path "repl-port") repl-local-port))
| (ns leiningen.droid.compatibility
"Contains utilities for letting lein-droid to cooperate with
ant/Eclipse build tools."
(:require [clojure.java.io :as io])
(:use [leiningen.core
[main :only [info]]
[classpath :only [resolve-dependencies]]]
[leiningen.droid.utils :only [ensure-paths]]))
(defn gather-dependencies
"Compatibility task. Copies the dependency libraries into the libs/ folder."
[{:keys [root] :as project} & {dir ":dir", :or {dir "libs"} :as other}]
(println (class (first (keys other))))
(info "Copying dependency libraries into" (str dir "..."))
(let [destination-dir (io/file root dir)
dependencies (resolve-dependencies :dependencies project)]
(.mkdirs destination-dir)
(doseq [dep dependencies]
(io/copy dep
(io/file destination-dir (.getName ^java.io.File dep))))))
(defn create-repl-port-file
"Creates a file named `.nrepl-port` in project directory with port
number inside, so that fireplace.vim can connect to the REPL."
[{{:keys [repl-local-port]} :android, root :root}]
(spit (io/file root ".nrepl-port") repl-local-port))
|
Use form helpers to create login form. | (ns cadence.views.landing
(:require [cadence.views.common :as common]
[noir.response :as response]
[noir.cookies :as cook])
(:use noir.core
hiccup.core
hiccup.page-helpers))
(defpage root "/" []
(common/layout
[:h1 "Cadence"]
[:p "Welcome to cadence"]))
(defpage login "/login" []
(common/layout
[:h1 "Login"]
[:p "WELCOME TO THE LOGIN PAGE!"]
[:form [:post "/login"]
[:input "Username"]
[:input "Password"]
[:input "Login"]]))
(defpage login-check [:post "/login"] []
(response/empty {:hello "world"}))
(defpage signup "/signup" []
(common/layout
[:h1 "Login"]
[:p "WELCOME TO THE LOGIN PAGE!"]))
(defpage about "/about" []
(common/layout
[:h1 "About"]
[:p "derpderpderp"]))
| (ns cadence.views.landing
(:require [cadence.views.common :as common]
[noir.response :as response]
[noir.cookies :as cook])
(:use noir.core
hiccup.core
hiccup.page-helpers
hiccup.form-helpers))
(defpage root "/" []
(common/layout
[:h1 "Cadence"]
[:p "Welcome to cadence"]))
(defn alabel [name] (label name name))
(defpartial form-with-labels
"Returns labels and text fields for each name in the given collection."
[coll]
(for [field coll]
(alabel field)
((if ((.toLower field) == "password") password-field text-field) field)))
(defpage login "/login" []
(common/layout
[:h1 "Login"]
[:p "WELCOME TO THE LOGIN PAGE!"]
(with-group "login"
(form-to [:post "/login"]
(form-with-labels ["Username" "Password"])
(submit-button "Login")))))
(defpage login-check [:post "/login"] []
(response/empty {:hello "world"}))
(defpage signup "/signup" []
(common/layout
[:h1 "Login"]
[:p "WELCOME TO THE LOGIN PAGE!"]))
(defpage about "/about" []
(common/layout
[:h1 "About"]
[:p "derpderpderp"]))
|
Move from SNAPSHOT to cider-nrepl 0.7.0 | {:user {:signing {:gpg-key "8ED1CE42"}
:dependencies [[alembic "0.2.1"]
[clj-stacktrace "0.2.7"]
[criterium "0.4.2"]
[org.clojure/tools.namespace "0.2.4"]
[slamhound "1.5.3"]
[spyscope "0.1.4"]]
:plugins [[cider/cider-nrepl "0.7.0-SNAPSHOT"]
[codox "0.6.6"]
[jonase/eastwood "0.1.4"]
[lein-ancient "0.5.5" :exclusions [commons-codec]]
[lein-cljsbuild "1.0.3"]
[lein-clojars "0.9.1"]
[lein-cloverage "1.0.2"]
[lein-difftest "2.0.0"]
[lein-kibit "0.0.8"]
[lein-marginalia "0.7.1"]
[lein-pprint "1.1.1"]
[lein-swank "1.4.4"]]
:injections [(require
'[alembic.still :refer [distill]]
'[clojure.repl :refer [source]]
'[clojure.tools.namespace.repl :as repl]
'[criterium.core :refer [bench quick-bench]]
'spyscope.core)]
:aliases {"slamhound" ["run" "-m" "slam.hound"]}
:search-page-size 50}}
| {:user {:signing {:gpg-key "8ED1CE42"}
:dependencies [[alembic "0.2.1"]
[clj-stacktrace "0.2.7"]
[criterium "0.4.2"]
[org.clojure/tools.namespace "0.2.4"]
[slamhound "1.5.3"]
[spyscope "0.1.4"]]
:plugins [[cider/cider-nrepl "0.7.0"]
[codox "0.6.6"]
[jonase/eastwood "0.1.4"]
[lein-ancient "0.5.5" :exclusions [commons-codec]]
[lein-cljsbuild "1.0.3"]
[lein-clojars "0.9.1"]
[lein-cloverage "1.0.2"]
[lein-difftest "2.0.0"]
[lein-kibit "0.0.8"]
[lein-marginalia "0.7.1"]
[lein-pprint "1.1.1"]
[lein-swank "1.4.4"]]
:injections [(require
'[alembic.still :refer [distill]]
'[clojure.repl :refer [source]]
'[clojure.tools.namespace.repl :as repl]
'[criterium.core :refer [bench quick-bench]]
'spyscope.core)]
:aliases {"slamhound" ["run" "-m" "slam.hound"]}
:search-page-size 50}}
|
Hide dropdown when no focus | (ns gigrig.components.pedal-search
(:require [redux.core :refer [dispatch!]]
[gigrig.actions :as a]))
(defn- search-field [{:keys [handle-change]}]
[:input {:type "text"
:placeholder "Search for a pedal"
:on-change #(handle-change (.. % -target -value))}])
(defn- suggestion [i props]
^{:key i} [:li
[:strong (:model props)]
(:brand props)])
(defn dropdown [props]
[:ul
(map-indexed suggestion (:suggestions props))])
(defn component [props]
[:div
[search-field {:handle-change (fn [val] (dispatch! a/searchfield-key-pressed val))}]
[dropdown (select-keys props [:suggestions])]])
| (ns gigrig.components.pedal-search
(:require [redux.core :refer [dispatch!]]
[reagent.core :as reagent]
[gigrig.actions :as a]))
(defn- search-field [{:keys [on-focus on-blur handle-change]}]
[:input {:type "text"
:placeholder "Search for a pedal"
:on-focus on-focus
:on-blur on-blur
:on-change #(handle-change (.. % -target -value))}])
(defn- suggestion [i props]
^{:key i} [:li
[:strong (:model props)]
(:brand props)])
(defn dropdown [props]
[:ul
(map-indexed suggestion (:suggestions props))])
(defn component []
(let [dropdown-visible (reagent/atom false)]
(fn [props]
[:div
[search-field {:on-focus #(do (reset! dropdown-visible true) nil)
:on-blur #(do (reset! dropdown-visible false) nil)
:handle-change (fn [val] (dispatch! a/searchfield-key-pressed val))}]
(if @dropdown-visible
[dropdown (select-keys props [:suggestions])])])))
|
Remove unneeded TLS cert expiration test | (ns clojars.unit.certs-test
(:require [clojure.test :refer [deftest is]]))
(def sixty-days (* 86400 1000 60))
(deftest fail-when-gpg-key-is-about-to-expire
(let [expire-date #inst "2021-12-25T00:00:00.000-00:00"]
(is (< (System/currentTimeMillis)
(- (.getTime expire-date) sixty-days))
(format "Security GPG key expires on %s" expire-date))))
(deftest fail-when-tls-cert-is-about-to-expire
(let [expire-date #inst "2020-06-17T00:00:00.000-00:00"]
(is (< (System/currentTimeMillis)
(- (.getTime expire-date) sixty-days))
(format "clojars.org TLS cert expires on %s.\nBe sure to give lein a copy of the new one: %s"
expire-date "https://github.com/technomancy/leiningen/blob/master/leiningen-core/resources/clojars.pem"))))
| (ns clojars.unit.certs-test
(:require [clojure.test :refer [deftest is]]))
(def sixty-days (* 86400 1000 60))
(deftest fail-when-gpg-key-is-about-to-expire
(let [expire-date #inst "2021-12-25T00:00:00.000-00:00"]
(is (< (System/currentTimeMillis)
(- (.getTime expire-date) sixty-days))
(format "Security GPG key expires on %s" expire-date))))
|
Change caught js exception type to :default | (ns mikron.runtime.util
"Generic utility functions."
(:require [mikron.compiler.util :as compiler.util])
#?(:cljs (:require-macros [mikron.runtime.util])))
#?(:cljs
(defn node-env?
"Returns `true` if compiled for Node.js, `false` otherwise."
[]
(= "nodejs" cljs.core/*target*)))
(defmacro safe
"Evaluates each expression of `body` and returns `ex-value` if an exception occured.
Otherwise returns the value of the last expression in `body`."
[ex-value & body]
`(try
(do ~@body)
(catch ~(if (compiler.util/cljs?) `js/Object `Throwable) e#
~ex-value)))
| (ns mikron.runtime.util
"Generic utility functions."
(:require [mikron.compiler.util :as compiler.util])
#?(:cljs (:require-macros [mikron.runtime.util])))
#?(:cljs
(defn node-env?
"Returns `true` if compiled for Node.js, `false` otherwise."
[]
(= "nodejs" cljs.core/*target*)))
(defmacro safe
"Evaluates each expression of `body` and returns `ex-value` if an exception occured.
Otherwise returns the value of the last expression in `body`."
[ex-value & body]
`(try
(do ~@body)
(catch ~(if (compiler.util/cljs?) :default `Throwable) e#
~ex-value)))
|
Replace fn with idiomatic function | (ns discuss.utils.extensions
"Extending JS types to be better accessible in CLJS.")
(def types [js/NodeList
js/HTMLCollection
js/HTMLDocument
js/HTMLDivElement
js/HTMLParagraphElement
js/HTMLSpanElement])
(defn extend-type-fn
"Given a type t, apply extensions."
[t]
(extend-type t
ISeqable
(-seq [array] (array-seq array 0))
ICounted
(-count [a] (alength a))
IIndexed
(-nth
([array n]
(if (< n (alength array)) (aget array n)))
([array n not-found]
(if (< n (alength array)) (aget array n)
not-found)))
ILookup
(-lookup
([array k]
(aget array k))
([array k not-found]
(-nth array k not-found)))
IReduce
(-reduce
([array f]
(ci-reduce array f))
([array f start]
(ci-reduce array f start)))))
(doall (map extend-type-fn types))
| (ns discuss.utils.extensions
"Extending JS types to be better accessible in CLJS.")
(def types [js/NodeList
js/HTMLCollection
js/HTMLDocument
js/HTMLDivElement
js/HTMLParagraphElement
js/HTMLSpanElement])
(defn extend-type-fn
"Given a type t, apply extensions."
[t]
(extend-type t
ISeqable
(-seq [array] (array-seq array 0))
ICounted
(-count [a] (alength a))
IIndexed
(-nth
([array n]
(if (< n (alength array)) (aget array n)))
([array n not-found]
(if (< n (alength array)) (aget array n)
not-found)))
ILookup
(-lookup
([array k]
(aget array k))
([array k not-found]
(-nth array k not-found)))
IReduce
(-reduce
([array f]
(ci-reduce array f))
([array f start]
(ci-reduce array f start)))))
(run! extend-type-fn types)
|
Write tests for util functions | (ns hydrofoil.expectations.utils
(:require [expectations :refer :all]
[hydrofoil.core :refer :all]
[hydrofoil.evolution :refer :all]))
;;; --------- Utils Tests ------------
(expect 2
(+ 1 1))
| (ns hydrofoil.expectations.utils
(:require [expectations :refer :all]
[hydrofoil.utils :refer :all]))
;;; --------- Utils Tests ------------
;; round-double tests
; Four Digits or less
(expect 0.1000
(round-double 0.1000))
(expect 0.9999
(round-double 0.9999))
; Over four digits
(expect 0.1
(round-double 0.100001))
(expect 1.0
(round-double 0.99999))
;; rand-double tests
(expect true
(<= 0.0 (rand-double 0 1) 1))
(expect true
(<= 0.5 (rand-double 0.5 12) 12))
(expect true
(<= -1.0 (rand-double -1.0 1.0) 1.0))
(expect 0.0
(rand-double 0 0))
|
Fix command line port handling | (ns jugsclojure.server
(:require [clojure.java.io :as io]
[compojure.core :refer [ANY GET PUT POST DELETE defroutes]]
[compojure.route :refer [resources]]
[ring.middleware.defaults :refer [wrap-defaults api-defaults]]
[ring.middleware.gzip :refer [wrap-gzip]]
[ring.middleware.logger :refer [wrap-with-logger]]
[environ.core :refer [env]]
[ring.adapter.jetty :refer [run-jetty]])
(:gen-class))
(defroutes routes
(GET "/" _
{:status 200
:headers {"Content-Type" "text/html; charset=utf-8"}
:body (io/input-stream (io/resource "public/index.html"))})
(resources "/"))
(def http-handler
(-> routes
(wrap-defaults api-defaults)
wrap-with-logger
wrap-gzip))
(defonce server (atom nil))
(defn restart-server [& [port]]
(swap! server (fn [value]
(when value (.stop value))
(run-jetty #'http-handler {:port (or port 10555) :join? false}))))
(defn -main [& [port]]
(let [port (Integer. (or port (env :port)))]
(restart-server port))) | (ns jugsclojure.server
(:require [clojure.java.io :as io]
[compojure.core :refer [ANY GET PUT POST DELETE defroutes]]
[compojure.route :refer [resources]]
[ring.middleware.defaults :refer [wrap-defaults api-defaults]]
[ring.middleware.gzip :refer [wrap-gzip]]
[ring.middleware.logger :refer [wrap-with-logger]]
[environ.core :refer [env]]
[ring.adapter.jetty :refer [run-jetty]])
(:gen-class))
(defroutes routes
(GET "/" _
{:status 200
:headers {"Content-Type" "text/html; charset=utf-8"}
:body (io/input-stream (io/resource "public/index.html"))})
(resources "/"))
(def http-handler
(-> routes
(wrap-defaults api-defaults)
wrap-with-logger
wrap-gzip))
(defonce server (atom nil))
(defn restart-server [& [port]]
(swap! server (fn [value]
(when value (.stop value))
(run-jetty #'http-handler {:port (or port 10555) :join? false}))))
(defn -main [& [port]]
(let [port (some-> (or port (env :port)) (Integer.))]
(restart-server port)))
|
Update cats dependency to 0.5.0 | (defproject buddy/buddy-sign "0.6.0"
:description "High level message signing for Clojure"
:url "https://github.com/funcool/buddy-sign"
:license {:name "Apache 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
[com.taoensso/nippy "2.9.0"]
[buddy/buddy-core "0.6.0"]
[cats "0.4.0"]
[clj-time "0.9.0"]
[cheshire "5.5.0"]]
:source-paths ["src"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:test-paths ["test"])
| (defproject buddy/buddy-sign "0.6.0"
:description "High level message signing for Clojure"
:url "https://github.com/funcool/buddy-sign"
:license {:name "Apache 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
[com.taoensso/nippy "2.9.0"]
[buddy/buddy-core "0.6.0"]
[funcool/cats "0.5.0"]
[clj-time "0.9.0"]
[cheshire "5.5.0"]]
:source-paths ["src"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:test-paths ["test"])
|
Prepare for next release cycle. | (defproject onyx-app/lein-template "0.9.7.0-alpha13"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-app/lein-template "0.9.7.0-SNAPSHOT"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Use modern clj + cljs versions | (defproject bolt "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.6.0" :scope "provided"]
[org.clojure/clojurescript "0.0-3149" :scope "provided"]
[rum "0.2.6"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[secretary "1.2.2"]]
:plugins [[lein-cljsbuild "1.0.5"]]
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src"]
:compiler {:main "bolt.core"
:output-to "resources/public/js/bolt.js"
:output-dir "resources/public/js/out"
:optimizations :none
:source-map true
:warnings {:single-segment-namespace false}
:asset-path "js/out"}}
{:id "prod"
:source-paths ["src"]
:notify-command ["say"]
:compiler {:output-to "resources/public/js/bolt.js"
:output-dir "resources/public/js/prod-out"
:optimizations :advanced
:source-map "resources/public/js/bolt.js.map"
:pretty-print false
:asset-path "js/prod-out"
:warnings {:single-segment-namespace false}
:externs ["resources/externs/w3c_speech.js"]}}]})
| (defproject bolt "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
[org.clojure/clojurescript "1.7.228" :scope "provided"]
[rum "0.2.6"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[secretary "1.2.2"]]
:plugins [[lein-cljsbuild "1.1.2"]]
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src"]
:compiler {:main "bolt.core"
:output-to "resources/public/js/bolt.js"
:output-dir "resources/public/js/out"
:optimizations :none
:source-map true
:warnings {:single-segment-namespace false}
:asset-path "js/out"}}
{:id "prod"
:source-paths ["src"]
:notify-command ["say"]
:compiler {:output-to "resources/public/js/bolt.js"
:output-dir "resources/public/js/prod-out"
:optimizations :advanced
:source-map "resources/public/js/bolt.js.map"
:pretty-print false
:asset-path "js/prod-out"
:warnings {:single-segment-namespace false}
:externs ["resources/externs/w3c_speech.js"]}}]})
|
Use a kabel version with bigger incoming buffer. | (defproject twitter-collector "0.1.0-SNAPSHOT"
:description "A Twitter collector with a Datomic stream."
:url "https://github.com/replikativ/twitter-collector"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[io.replikativ/gezwitscher "0.2.0-SNAPSHOT"]
[io.replikativ/replikativ "0.2.1"]
[employeerepublic/slf4j-timbre "0.4.2"]
[com.datomic/datomic-free "0.9.5554"
:exclusions [commons-codec]]
[incanter "1.5.7"]]
:main twitter-collector.core)
| (defproject twitter-collector "0.1.0-SNAPSHOT"
:description "A Twitter collector with a Datomic stream."
:url "https://github.com/replikativ/twitter-collector"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[io.replikativ/gezwitscher "0.2.0-SNAPSHOT"]
[io.replikativ/kabel "0.2.1-SNAPSHOT"]
[io.replikativ/replikativ "0.2.1"]
[employeerepublic/slf4j-timbre "0.4.2"]
[com.datomic/datomic-free "0.9.5554"
:exclusions [commons-codec]]
[incanter "1.5.7"]]
:main twitter-collector.core)
|
Extend set-msg! with custom timeout | (ns lt.objs.notifos
(:require [lt.object :as object]
[lt.objs.statusbar :as statusbar]
[lt.objs.command :as cmd]
[lt.util.js :refer [wait]]
[crate.binding :refer [map-bound bound deref?]])
(:require-macros [lt.macros :refer [behavior defui]]))
(def standard-timeout 10000)
(defn working [msg]
(when msg
(set-msg! msg))
(statusbar/loader-inc))
(defn done-working
([]
(statusbar/loader-dec))
([msg]
(set-msg! msg)
(statusbar/loader-dec)))
(defn msg* [m & [opts]]
(let [m (if (string? m)
m
(pr-str m))]
(object/merge! statusbar/statusbar-loader (merge {:message m :class ""} opts))))
(defn set-msg! [msg opts]
(msg* msg opts)
(js/clearTimeout cur-timeout)
(set! cur-timeout (wait standard-timeout #(msg* ""))))
(cmd/command {:command :reset-working
:desc "Statusbar: Reset working indicator"
:exec (fn []
(statusbar/loader-set 0)
)})
| (ns lt.objs.notifos
(:require [lt.object :as object]
[lt.objs.statusbar :as statusbar]
[lt.objs.command :as cmd]
[lt.util.js :refer [wait]]
[crate.binding :refer [map-bound bound deref?]])
(:require-macros [lt.macros :refer [behavior defui]]))
(def standard-timeout 10000)
(defn working [msg]
(when msg
(set-msg! msg))
(statusbar/loader-inc))
(defn done-working
([]
(statusbar/loader-dec))
([msg]
(set-msg! msg)
(statusbar/loader-dec)))
(defn msg* [m & [opts]]
(let [m (if (string? m)
m
(pr-str m))]
(object/merge! statusbar/statusbar-loader (merge {:message m :class ""} opts))))
(defn set-msg!
([msg]
(msg* msg)
(js/clearTimeout cur-timeout)
(set! cur-timeout (wait standard-timeout #(msg* ""))))
([msg opts]
(msg* msg opts)
(js/clearTimeout cur-timeout)
(set! cur-timeout (wait (or (:timeout opts)
standard-timeout) #(msg* "")))))
(cmd/command {:command :reset-working
:desc "Statusbar: Reset working indicator"
:exec (fn []
(statusbar/loader-set 0)
)})
|
Improve tests for empty request specs | (ns icecap.schema-test
(:require [icecap.schema :refer :all]
[clojure.test :refer :all]
[schema.core :as s]))
(def simple-http-request {:target "http://example.test"})
(def simple-https-request {:target "https://example.test"})
(def simple-ftp-request {:target "ftp://example.test"})
(deftest RequestSpecTests
(testing "Correct request specs validate"
(are [example] (s/validate RequestSpec example)
simple-http-request
simple-https-request
#{simple-http-request simple-https-request}))
(testing "Empty collections don't validate"
(are [example] (some? (s/check RequestSpec example))
[]
#{}))
(testing "Request specs with unknown/unsupported schemes don't validate"
;; Comparing string representations isn't great, but it's the best
;; easily available tool until maybe one day cddr/integrity's
;; humanize function is on Clojars + can humanize these errors :-)
(are [example reason] (= (pr-str (s/check RequestSpec example))
(pr-str reason))
simple-ftp-request {:target '(not ("supported-scheme?" "ftp://example.test"))})))
| (ns icecap.schema-test
(:require [icecap.schema :refer :all]
[clojure.test :refer :all]
[schema.core :as s]))
(def simple-http-request {:target "http://example.test"})
(def simple-https-request {:target "https://example.test"})
(def simple-ftp-request {:target "ftp://example.test"})
(deftest RequestSpecTests
(testing "Correct request specs validate"
(are [example] (s/validate RequestSpec example)
simple-http-request
simple-https-request
#{simple-http-request simple-https-request}))
(testing "Empty specs don't validate"
(are [example reason] (= (pr-str (s/check RequestSpec example))
(pr-str reason))
[] '(not ("collection of one or more request specs" []))
#{} '(not ("collection of one or more request specs" #{}))))
(testing "Request specs with unknown/unsupported schemes don't validate"
;; Comparing string representations isn't great, but it's the best
;; easily available tool until maybe one day cddr/integrity's
;; humanize function is on Clojars + can humanize these errors :-)
(are [example reason] (= (pr-str (s/check RequestSpec example))
(pr-str reason))
simple-ftp-request {:target '(not ("supported-scheme?" "ftp://example.test"))})))
|
Delete generated chart file only if it exists already | (ns clj-gatling.chart-test
(:use [clojure.test])
(:require [clojure.java.io :as io]
[clj-gatling.chart :as chart]))
(defn create-dir [dir]
(.mkdirs (java.io.File. dir)))
(defn copy-file [source-path dest-path]
(io/copy (io/file source-path) (io/file dest-path)))
(deftest creates-chart-from-simulation-file
(create-dir "target/test-results/input")
(copy-file "test/simulation.log" "target/test-results/input/simulation.log")
(io/delete-file "target/test-results/output/index.html")
(chart/create-chart "target/test-results")
(is (.exists (io/as-file "target/test-results/output/index.html"))))
| (ns clj-gatling.chart-test
(:use [clojure.test])
(:require [clojure.java.io :as io]
[clj-gatling.chart :as chart]))
(defn create-dir [dir]
(.mkdirs (java.io.File. dir)))
(defn copy-file [source-path dest-path]
(io/copy (io/file source-path) (io/file dest-path)))
(defn delete-file-if-exists [path]
(when (.exists (io/as-file path))
(io/delete-file path)))
(deftest creates-chart-from-simulation-file
(create-dir "target/test-results/input")
(copy-file "test/simulation.log" "target/test-results/input/simulation.log")
(delete-file-if-exists "target/test-results/output/index.html")
(chart/create-chart "target/test-results")
(is (.exists (io/as-file "target/test-results/output/index.html"))))
|
Improve test runner by formatting and coloring favicon | (ns gigrig.test-runner
(:require [cljs.test :as test :include-macros true :refer [report]]
[devtools.core :as devtools]
[gigrig.tests-to-run]))
(enable-console-print!)
(devtools/install! [:custom-formatters :sanity-hints])
(test/run-all-tests #"gigrig.*-test")
(.groupCollapsed js/console "Figwheel Information")
| (ns gigrig.test-runner
(:require [cljs.test :as test :include-macros true :refer [report]]
[devtools.core :as devtools]
[goog.string :as str]
[goog.string.format]
[gigrig.tests-to-run]))
(enable-console-print!)
(devtools/install! [:custom-formatters :sanity-hints])
(defn color-favicon-data-url
"Takes a color and returns a 16x16 data url of the color"
[color]
(let [cvs (.createElement js/document "canvas")]
(set! (.-width cvs) 16)
(set! (.-height cvs) 16)
(let [ctx (.getContext cvs "2d")]
(set! (.-fillStyle ctx) color)
(.fillRect ctx 0 0 16 16))
(.toDataURL cvs)))
(defn change-favicon-to-color
"Changes the tabs favicon to the given color"
[color]
(let [icon (.getElementById js/document "favicon")]
(set! (.-href icon) (color-favicon-data-url color))))
(defn log
"Logs any text to the console with the given color"
[{:keys [color]} & args]
(.log js/console (apply str "%c" args)
(str "color: " color "; font-weight: bold")))
(defmethod report [::test/default :summary] [{:keys [fail error test pass]}]
(let [failure (< 0 (+ fail error))
color (if failure "#d00" "#0d0")]
(log {:color "blue"}
(str/format "Ran %d tests containing %d assertions" test (+ pass fail error)))
(log {:color color}
(str/format "%d failures, %d errors" fail error))
(change-favicon-to-color color)))
(.clear js/console)
(test/run-all-tests #"gigrig.*-test")
(.groupCollapsed js/console "Figwheel Information")
|
Comment out the backend code, to allow heroku to start | (ns circleci.init
;; (:require circleci.swank)
(:require circleci.db)
(:require circleci.db.migrations)
(:require circleci.web)
(:require circleci.repl)
(:require circleci.logging)
(:require circleci.backend.nodes
circleci.backend.project.rails
circleci.backend.project.circleci))
(def init*
(delay
(try
(circleci.logging/init)
;; (circleci.swank/init)
(circleci.db/init)
(circleci.db.migrations/init)
(circleci.web/init)
(circleci.repl/init)
true
(catch Exception e
(println "caught exception on startup:")
(.printStackTrace e)
(println "exiting")
(System/exit 1)))))
(defn init
"Start everything up. idempotent."
[]
@init*)
(defn -main []
(init)) | (ns circleci.init
;; (:require circleci.swank)
(:require circleci.db)
(:require circleci.db.migrations)
(:require circleci.web)
(:require circleci.repl)
(:require circleci.logging)
;; (:require circleci.backend.nodes
;; circleci.backend.project.rails
;; circleci.backend.project.circleci)
)
(def init*
(delay
(try
(circleci.logging/init)
;; (circleci.swank/init)
(circleci.db/init)
(circleci.db.migrations/init)
(circleci.web/init)
(circleci.repl/init)
true
(catch Exception e
(println "caught exception on startup:")
(.printStackTrace e)
(println "exiting")
(System/exit 1)))))
(defn init
"Start everything up. idempotent."
[]
@init*)
(defn -main []
(init)) |
Use manners instead of faulter. | (ns incise.config
(:require [clojure.java.io :refer [reader file resource]]
[clojure.edn :as edn]
[faulter.core :refer [faultless!]])
(:import [java.io PushbackReader])
(:refer-clojure :exclude [merge load assoc get]))
(def ^:private config (atom {}))
(defn load []
(when-let [config-file (file (resource "incise.edn"))]
(reset! config (edn/read (PushbackReader. (reader config-file))))))
(defn assoc [& more]
(apply swap! config clojure.core/assoc more))
(def ^:private validations
[[(comp string? :in-dir) "must have an input dir"]
[(comp string? :out-dir) "must have an output dir"]])
(defn faultless-config!
"Throws an AssertionError unless the given config map, or @config if not
supplied, has no faults."
[& [given-config]]
(faultless! 'config validations (or given-config @config)))
(defn get [& more]
(faultless-config!)
(if (empty? more)
@config
(apply @config more)))
(defn merge [& more]
(apply swap! config
clojure.core/merge more))
| (ns incise.config
(:require [clojure.java.io :refer [reader file resource]]
[clojure.edn :as edn]
[manners.victorian :refer [avow!]])
(:import [java.io PushbackReader])
(:refer-clojure :exclude [merge load assoc get]))
(def ^:private config (atom {}))
(defn load []
(when-let [config-file (file (resource "incise.edn"))]
(reset! config (edn/read (PushbackReader. (reader config-file))))))
(defn assoc [& more]
(apply swap! config clojure.core/assoc more))
(def ^:private validations
[[(comp string? :in-dir) "must have an input dir"]
[(comp string? :out-dir) "must have an output dir"]])
(defn avow-config!
"Throws an AssertionError unless the given config map, or @config if not
supplied, has no faults."
[& [given-config]]
(avow! 'config validations (or given-config @config)))
(defn get [& more]
(avow-config!)
(if (empty? more)
@config
(apply @config more)))
(defn merge [& more]
(apply swap! config
clojure.core/merge more))
|
Change order of arguments in anagram script | (defn swap [a i j]
(assoc a j (a i) i (a j)))
(defn generatePermutations [n v]
(if (zero? n)
(println (apply str v))
(loop [i 0 a v]
(if (<= i n)
(do
(generatePermutations (dec n) a)
(recur (inc i) (swap a (if (even? n) i 0) n)))))))
(if (not= (count *command-line-args*) 1)
(do
(println "Exactly one argument is required")
(System/exit 1))
(let [word (-> *command-line-args* first vec)]
(generatePermutations (dec (count word)) word)))
| (defn swap [a i j]
(assoc a j (a i) i (a j)))
(defn generatePermutations [v n]
(if (zero? n)
(println (apply str v))
(loop [i 0 a v]
(if (<= i n)
(do
(generatePermutations a (dec n))
(recur (inc i) (swap a (if (even? n) i 0) n)))))))
(if (not= (count *command-line-args*) 1)
(do
(println "Exactly one argument is required")
(System/exit 1))
(let [word (-> *command-line-args* first vec)]
(generatePermutations word (dec (count word)))))
|
Add nil fix in hash-map func. | (ns ombs.funcs "contains generic functions")
(defn in?
"checks if value contained in collection. Used for vectors. For maps, use 'some'"
[v coll]
(boolean (some #(= v %) coll))
)
(defn as-vec
"get a vector or value and represents it as vector. [1 2 3] -> [1 2 3]; 1 -> [1]"
[x] (if-not (vector? x)
(conj [] x)
x))
(defn parse-int [s]
(when-let [r (re-find #"\d+" s )] (Integer. r)))
| (ns ombs.funcs "contains generic functions")
(defn in?
"checks if value contained in collection. Used for vectors. For maps, use 'some'"
[v coll]
(boolean (some #(= v %) coll))
)
(defn as-vec
"get a vector or value and represents it as vector. [1 2 3] -> [1 2 3]; 1 -> [1]"
[x] (if-not (vector? x)
(conj [] x)
x))
(defn parse-int [s]
(when-let [r (re-find #"\d+" s )] (Integer. r)))
(defn nil-fix
"Replace nil value to 0"
[v] (if (nil? v) 0 v))
|
Add another test for arg chaining. | (ns test-core
(:use [leiningen.core :only [make-groups]] :reload-all)
(:use [clojure.test]))
(deftest test-make-groups-empty-args
(is (= [[]] (make-groups []))))
(deftest test-make-groups-single-task
(is (= [["pom"]] (make-groups ["pom"]))))
(deftest test-make-groups-without-args
(is (= [["clean"] ["deps"] ["test"]]
(make-groups ["clean," "deps," "test"]))))
(deftest test-make-groups-with-args
(is (= [["test" "test-core"] ["version"]]
(make-groups ["test" "test-core," "version"]))))
| (ns test-core
(:use [leiningen.core :only [make-groups]] :reload-all)
(:use [clojure.test]))
(deftest test-make-groups-empty-args
(is (= [[]] (make-groups []))))
(deftest test-make-groups-single-task
(is (= [["pom"]] (make-groups ["pom"]))))
(deftest test-make-groups-without-args
(is (= [["clean"] ["deps"] ["test"]]
(make-groups ["clean," "deps," "test"]))))
(deftest test-make-groups-with-args
(is (= [["test" "test-core"] ["version"]]
(make-groups ["test" "test-core," "version"]))))
(deftest test-make-groups-with-long-chain
(is (= [["help" "help"] ["help" "version"] ["version"]
["test" "test-compile"]]
(make-groups '("help" "help," "help" "version," "version,"
"test" "test-compile")))))
|
Enable reload on file save | (ns ^:figwheel-no-load env.ios.main
(:require [re-natal-om-next.ios.core :as core]
[figwheel.client :as figwheel :include-macros true]))
(enable-console-print!)
(figwheel/watch-and-reload
:websocket-url "ws://localhost:3449/figwheel-ws"
:heads-up-display true)
(core/init) | (ns ^:figwheel-no-load env.ios.main
(:require [re-natal-om-next.ios.core :as core]
[figwheel.client :as figwheel :include-macros true]))
(enable-console-print!)
(figwheel/watch-and-reload
:websocket-url "ws://localhost:3449/figwheel-ws"
:heads-up-display true
:jsload-callback re-natal-om-next.ios.core/init)
(core/init)
|
Reduce handshake dialog coming from client | (ns frereth.fsm
"This is a misnomer. But I have to start somewhere."
(:require [frereth.globals :as global]
[ribol.cljs :refer [create-issue
*managers*
*optmap*
raise-loop]]
[taoensso.timbre :as log])
(:require-macros [ribol.cljs :refer [raise]]))
(defn transition-to-html5
[{:keys [body css script] :as html}]
(raise {:not-implemented html}))
(defn transition-world
"Far too much information is getting here.
TODO: Client needs to prune most of it.
This part really only cares about the world"
[{:keys [action-url
expires
session-token
world]}]
(let [data (:data world)
{:keys [type version]} data]
(cond
(and (= type :html)
(= version 5)) (transition-to-html5 (select-keys data [:body :css :script])))))
| (ns frereth.fsm
"This is a misnomer. But I have to start somewhere."
(:require [frereth.globals :as global]
[ribol.cljs :refer [create-issue
*managers*
*optmap*
raise-loop]]
[taoensso.timbre :as log])
(:require-macros [ribol.cljs :refer [raise]]))
(defn transition-to-html5
[{:keys [body css script] :as html}]
;; Q: Aren't we supposed to have symbol maps that provide useful info for this sort of thing now?
(raise {:not-implemented html
:stack-trace "Start Transition"}))
(defn transition-world
"Let's get this party started!"
[{:keys [action-url
expires
session-token
world]
:as destination}]
(log/info "=========================================
This is important!!!!!
World transition to:
=========================================\n"
;; LOL First time I tried this, I hit :hold-please
destination)
(let [data (:data destination)
{:keys [type version]} data]
(cond
;; TODO: Need an obvious way to do exactly that.
;; Although, this seems to be acting on something like a semaphore model
;; right now.
;; Call it once, it fails.
;; Succeeds the second time around.
;; Q: What do I have wrong with the basic server interaction?
(= destination :hold-please) (js/alert "Don't make me call a second time")
(and (= type :html)
(= version 5)) (transition-to-html5 (select-keys data [:body :css :script]))
:else (js/alert (str "Don't understand World Transition Response:\n"
destination
"\nwhich is a: " (type destination)
"\nTop-Level Keys:\n"
(keys destination)
"\nkeys that matter inside the data:\n"
(keys data)
"\nN.B.: data is an instance of: "
(comment (type data))
"\nSmart money says that nested data isn't getting deserialized correctly")))))
|
Add namespace metadata to example test suite | (ns suite1
(:use [com.stuartsierra.lazytest :only (deftest defsuite)]))
(deftest even-odd []
(odd? 1)
(even? 2)
(odd? 3)
(even? 4))
(deftest zero "Zero is even, not odd" []
(even? 0)
"Zero is not odd"
(odd? 0))
(defsuite numbers "Simple number tests" []
even-odd zero)
(deftest addition []
(= 2 (+ 1 1))
(= 3 (+ 2 1))
"Psychotic math"
(= 5 (+ 2 2)))
(deftest subtraction []
(= 0 (- 1 1))
(= 1 (- 2 1))
(= 3 (- 5 2)))
(defsuite arithmetic []
addition subtraction)
(defsuite all-tests []
numbers arithmetic) | (ns suite1
(:use [com.stuartsierra.lazytest :only (deftest defsuite)]))
(deftest even-odd []
(odd? 1)
(even? 2)
(odd? 3)
(even? 4))
(deftest zero "Zero is even, not odd" []
(even? 0)
"Zero is not odd"
(odd? 0))
(defsuite numbers "Simple number tests" []
even-odd zero)
(deftest addition []
(= 2 (+ 1 1))
(= 3 (+ 2 1))
"Psychotic math"
(= 5 (+ 2 2)))
(deftest subtraction []
(= 0 (- 1 1))
(= 1 (- 2 1))
(= 3 (- 5 2)))
(defsuite arithmetic []
addition subtraction)
(defsuite all-tests []
numbers arithmetic)
(alter-meta! *ns* assoc :test all-tests) |
Update to latest clojure version | (defproject cljsearch "0.1.0-SNAPSHOT"
:description "cljsearch - the clojure version of the xsearch command-line-based search utility"
:url "https://github.com/clarkcb/xsearch"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [
[org.clojure/clojure "1.8.0"]
[org.clojure/data.json "0.2.6"]
]
:main ^:skip-aot cljsearch.cljsearch
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
| (defproject cljsearch "0.1.0-SNAPSHOT"
:description "cljsearch - the clojure version of the xsearch command-line-based search utility"
:url "https://github.com/clarkcb/xsearch"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [
[org.clojure/clojure "1.9.0"]
[org.clojure/data.json "0.2.6"]
]
:main ^:skip-aot cljsearch.cljsearch
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
|
Add proper label to draw tools. | (ns uxbox.locales.en)
(defonce +locales+
{"ds.projects" "PROJECTS"
"ds.num-projects" ["No projects"
"%s project"
"%s projects"]
"ds.project-ordering" "Sort by"
"ds.project-ordering.by-name" "name"
"ds.project-ordering.by-last-update" "last update"
"ds.project-ordering.by-creation-date" "creation date"
"ds.project-search.placeholder" "Search..."
"ds.elements" "ELEMENTS"
"ds.icons" "ICONS"
"ds.colors" "COLORS"
"ds.library-title" "Library: "
"ds.standard-title" "STANDARD"
"ds.your-libraries-title" "YOUR LIBRARIES"
"ds.num-elements" ["%s element"
"%s elements"]
"ds.recent-colors" "Recent colors"
"ds.element-options" "Element options"
"ds.tools" "Tools"
"ds.sitemap" "Sitemap"
"ds.help.rect" "Box (Ctrl + B)"
"ds.help.circle" "Circle (Ctrl + E)"
"ds.help.line" "Line (Ctrl + L)"
})
| (ns uxbox.locales.en)
(defonce +locales+
{"ds.projects" "PROJECTS"
"ds.num-projects" ["No projects"
"%s project"
"%s projects"]
"ds.project-ordering" "Sort by"
"ds.project-ordering.by-name" "name"
"ds.project-ordering.by-last-update" "last update"
"ds.project-ordering.by-creation-date" "creation date"
"ds.project-search.placeholder" "Search..."
"ds.elements" "ELEMENTS"
"ds.icons" "ICONS"
"ds.colors" "COLORS"
"ds.library-title" "Library: "
"ds.standard-title" "STANDARD"
"ds.your-libraries-title" "YOUR LIBRARIES"
"ds.num-elements" ["%s element"
"%s elements"]
"ds.recent-colors" "Recent colors"
"ds.element-options" "Element options"
"ds.draw-tools" "Draw tools"
"ds.sitemap" "Sitemap"
"ds.help.rect" "Box (Ctrl + B)"
"ds.help.circle" "Circle (Ctrl + E)"
"ds.help.line" "Line (Ctrl + L)"
})
|
Add cats dependency and update buddy-core to 0.4.0-SNAPSHOT version. | (defproject buddy/buddy-sign "0.3.0"
:description "Security library for Clojure"
:url "https://github.com/funcool/buddy-sign"
:license {:name "BSD (2-Clause)"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:dependencies [[org.clojure/clojure "1.6.0"]
[com.taoensso/nippy "2.7.1"]
[buddy/buddy-core "0.3.0"]
[cats "0.2.0"]
[clj-time "0.9.0"]
[cheshire "5.4.0"]]
:source-paths ["src"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:test-paths ["test"])
| (defproject buddy/buddy-sign "0.3.0"
:description "Security library for Clojure"
:url "https://github.com/funcool/buddy-sign"
:license {:name "BSD (2-Clause)"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:dependencies [[org.clojure/clojure "1.6.0"]
[com.taoensso/nippy "2.7.1"]
[buddy/buddy-core "0.4.0-SNAPSHOT"]
[cats "0.3.2"]
[clj-time "0.9.0"]
[cheshire "5.4.0"]]
:source-paths ["src"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:test-paths ["test"])
|
Change group name from "twixt" to "io.aviso" | (defproject twixt "0.1.0"
:description "An extensible asset pipeline for Clojure web applications"
:url "https://github.com/AvisoNovate/twixt"
:license {:name "Apache Sofware Licencse 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/tools.logging "0.2.6"]
[ring/ring-core "1.1.8"]
[org.mozilla/rhino "1.7R4"]
[com.github.sommeri/less4j "1.0.4"]
[de.neuland/jade4j "0.3.12"]]
:repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]]
:profiles {:dev {:dependencies [[log4j "1.2.17"]]}}) | (defproject io.aviso/twixt "0.1.0"
:description "An extensible asset pipeline for Clojure web applications"
:url "https://github.com/AvisoNovate/twixt"
:license {:name "Apache Sofware Licencse 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/tools.logging "0.2.6"]
[ring/ring-core "1.1.8"]
[org.mozilla/rhino "1.7R4"]
[com.github.sommeri/less4j "1.0.4"]
[de.neuland/jade4j "0.3.12"]]
:repositories [["jade4j" "https://raw.github.com/neuland/jade4j/master/releases"]]
:profiles {:dev {:dependencies [[log4j "1.2.17"]]}}) |
Remove the `dev` directory from the `:dev` profile | (defproject com.walmartlabs/logback-riemann-appender "0.1.5-SNAPSHOT"
:description "Logback Appender that sends events to Riemann"
:url "https://github.com/walmartlabs/logback-riemann-appender"
:lein-release {:deploy-via :clojars}
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:java-source-paths ["java"]
:javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
:junit ["test/java"]
:plugins [[lein-junit "1.1.8"]
[lein-release/lein-release "1.0.5"]
[lein-swank "1.4.5"]]
:profiles {:dev {:dependencies [[junit/junit "4.11"]]
:resource-paths ["dev-resources"]
:source-paths ["dev" "test/clojure"]
:java-source-paths ["test/java"]}}
:dependencies [
[org.clojure/clojure "1.5.1"]
[com.aphyr/riemann-java-client "0.2.8"]
[ch.qos.logback/logback-classic "1.0.13"]
[org.clojure/tools.logging "0.2.6"]]
:signing {:gpg-key "dante@walmartlabs.com"})
| (defproject com.walmartlabs/logback-riemann-appender "0.1.5-SNAPSHOT"
:description "Logback Appender that sends events to Riemann"
:url "https://github.com/walmartlabs/logback-riemann-appender"
:lein-release {:deploy-via :clojars}
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:java-source-paths ["java"]
:javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
:junit ["test/java"]
:plugins [[lein-junit "1.1.8"]
[lein-release/lein-release "1.0.5"]
[lein-swank "1.4.5"]]
:profiles {:dev {:dependencies [[junit/junit "4.11"]]
:resource-paths ["dev-resources"]
:source-paths ["test/clojure"]
:java-source-paths ["test/java"]}
:repl {:source-paths ["dev"]}}
:dependencies [
[org.clojure/clojure "1.5.1"]
[com.aphyr/riemann-java-client "0.2.8"]
[ch.qos.logback/logback-classic "1.0.13"]
[org.clojure/tools.logging "0.2.6"]]
:signing {:gpg-key "dante@walmartlabs.com"})
|
Upgrade curator-x-discovery 2.4.2 -> 2.5.0 | (defproject eureka "0.1.5-SNAPSHOT"
:description "A Clojure library that wraps the Curator service discovery/registration API."
:dependencies [[cheshire "5.2.0"]
[environ "0.4.0"]
[org.apache.curator/curator-x-discovery "2.4.2"]
[org.clojure/clojure "1.5.1"]
[org.clojure/tools.logging "0.2.6"]
[zookeeper-clj "0.9.3"]]
:profiles {:dev {:dependencies [[zookem "0.1.0-SNAPSHOT"]
[midje "1.5.1"]]
:plugins [[lein-midje "3.0.1"]
[lein-release "1.0.5"]]}}
:lein-release {:deploy-via :clojars
:clojars-url "clojars@clojars.brislabs.com:"})
| (defproject eureka "0.1.5-SNAPSHOT"
:description "A Clojure library that wraps the Curator service discovery/registration API."
:dependencies [[cheshire "5.2.0"]
[environ "0.4.0"]
[org.apache.curator/curator-x-discovery "2.5.0"]
[org.clojure/clojure "1.5.1"]
[org.clojure/tools.logging "0.2.6"]
[zookeeper-clj "0.9.3"]]
:profiles {:dev {:dependencies [[zookem "0.1.0-SNAPSHOT"]
[midje "1.5.1"]]
:plugins [[lein-midje "3.0.1"]
[lein-release "1.0.5"]]}}
:lein-release {:deploy-via :clojars
:clojars-url "clojars@clojars.brislabs.com:"})
|
Remove gen alias (not required) | (defproject {{name}} "0.1.0-SNAPSHOT"
:description "A modular project created with lein new modular {{template}}"
:url "http://github.com/{{user}}/{{name}}"
:dependencies
[
{{#library-dependencies}}
{{{.}}}
{{/library-dependencies}}
]
:main {{name}}.main
:repl-options {:init-ns user
:welcome (println "Type (dev) to start")}
:aliases {"gen" ["run" "-m" "{{name}}.generate"]}
:profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.10"]]
:source-paths ["dev"
]}})
| (defproject {{name}} "0.1.0-SNAPSHOT"
:description "A modular project created with lein new modular {{template}}"
:url "http://github.com/{{user}}/{{name}}"
:dependencies
[
{{#library-dependencies}}
{{{.}}}
{{/library-dependencies}}
]
:main {{name}}.main
:repl-options {:init-ns user
:welcome (println "Type (dev) to start")}
:profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.10"]]
:source-paths ["dev"
]}})
|
Print day names, show today's date. | (ns tunnit.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[cljs-time.core :as time]
[om-tools.dom :as ot :include-macros true]
[om-tools.core :refer-macros [defcomponent]]
))
(enable-console-print!)
(defonce app-state (atom {:text "Viikko"}))
(def week-map
{:mon [] :tue [] :wed [] :thu [] :fri [] :sat [] :sun []})
(defcomponent week-view [app owner]
(render [this]
(ot/div
(map (fn [day]
(ot/output (str day)))
(keys week-map))
))
)
(defcomponent app-view [app owner]
(render [this]
(ot/div {:class "column-main"}
(dom/h1 nil (:text app))
(om/build week-view app)
)
))
(defn main []
(om/root
app-view
app-state
{:target (. js/document (getElementById "app"))})) | (ns tunnit.core
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[cljs-time.core :as time]
[cljs-time.format :as format]
[om-tools.dom :as ot :include-macros true]
[om-tools.core :refer-macros [defcomponent]]
))
(enable-console-print!)
(def app-state (atom {:text "Viikko" :date ""}))
(def week-map
{:mon ["Ma"] :tue ["Ti"] :wed ["Ke"] :thu ["To"] :fri ["Pe"] :sat ["La"] :sun ["Su"]})
(def date-format
(format/formatter "dd.MM.yyyy"))
(defn today []
(format/unparse date-format (time/now)))
(defcomponent week-view [app owner]
(render [this]
(om/update! app :date (today))
(ot/div
(map (fn [day]
(ot/output {:class "day-label"} (str (first day))))
(vals week-map))
))
)
(defcomponent app-view [app owner]
(render [this]
(print (format/show-formatters))
(ot/div {:class "column-main"}
(dom/h1 nil (str (:text app) " " (:date app)))
(om/build week-view app)
)
))
(defn main []
(om/root
app-view
app-state
{:target (. js/document (getElementById "app"))}))
|
Add example using nested describes | (ns examples.describe1
(:use lazytest.describe))
(describe +
(it "computes the sum of 3 and 4"
(= 7 (+ 3 4))))
(describe + "given any 2 integers"
(for [x (range 5), y (range 5)]
(it "is commutative"
(= (+ x y) (+ y x)))))
| (ns examples.describe1
(:use lazytest.describe))
(describe +
(it "computes the sum of 3 and 4"
(= 7 (+ 3 4))))
(describe + "given any 2 integers"
(for [x (range 5), y (range 5)]
(it "is commutative"
(= (+ x y) (+ y x)))))
(describe +
(describe "with integers"
(it "computes sums of small numbers"
(= 7 (+ 3 4)))
(it "computes sums of large numbers"
(= 7000000 (+ 3000000 4000000))))
(describe "with floating point"
(it "computes sums of small numbers"
(= 0.0000007 (+ 0.0000003 0.0000004)))
(it "computes sums of large numbers"
(= 7000000.0 (+ 3000000.0 4000000.0)))))
|
Clean up the target dir | (set-env!
:source-paths #{"src" "src-java"}
:resource-paths #{"resources"}
:dependencies '[[org.clojure/test.check "0.9.0" :scope "test"]
; project deps
[org.clojure/clojure "1.9.0-alpha7"]
[leiningen "2.6.1" :exclusions [leiningen.search]]
[ring "1.4.0"]
[clojail "1.0.6"]])
(task-options!
pom {:project 'nightcode
:version "2.0.0-SNAPSHOT"}
aot {:namespace '#{net.sekao.nightcode.core
net.sekao.nightcode.lein}}
jar {:main 'net.sekao.nightcode.core
:manifest {"Description" "An IDE for Clojure and ClojureScript"
"Url" "https://github.com/oakes/Nightcode"}})
(deftask run []
(comp
(javac)
(aot)
(with-pre-wrap fileset
(require '[net.sekao.nightcode.core :refer [dev-main]])
((resolve 'dev-main))
fileset)))
(deftask run-repl []
(comp
(javac)
(aot)
(repl :init-ns 'net.sekao.nightcode.core)))
(deftask build []
(comp (javac) (aot) (pom) (uber) (jar) (target)))
| (set-env!
:source-paths #{"src" "src-java"}
:resource-paths #{"resources"}
:dependencies '[[org.clojure/test.check "0.9.0" :scope "test"]
; project deps
[org.clojure/clojure "1.9.0-alpha7"]
[leiningen "2.6.1" :exclusions [leiningen.search]]
[ring "1.4.0"]
[clojail "1.0.6"]])
(task-options!
sift {:include #{#"\.jar$"}}
pom {:project 'nightcode
:version "2.0.0-SNAPSHOT"}
aot {:namespace '#{net.sekao.nightcode.core
net.sekao.nightcode.lein}}
jar {:main 'net.sekao.nightcode.core
:manifest {"Description" "An IDE for Clojure and ClojureScript"
"Url" "https://github.com/oakes/Nightcode"}})
(deftask run []
(comp
(javac)
(aot)
(with-pre-wrap fileset
(require '[net.sekao.nightcode.core :refer [dev-main]])
((resolve 'dev-main))
fileset)))
(deftask run-repl []
(comp
(javac)
(aot)
(repl :init-ns 'net.sekao.nightcode.core)))
(deftask build []
(comp (javac) (aot) (pom) (uber) (jar) (sift) (target)))
|
Add bidi dependency to :dev profile (just for benchmarks). | (defproject funcool/bide "1.0.0-SNAPSHOT"
:description "Simple routing for ClojureScript"
:url "https://github.com/funcool/bide"
:license {:name "BSD (2-Clause)"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
[org.clojure/clojurescript "1.9.227" :scope "provided"]]
:deploy-repositories {"releases" :clojars
"snapshots" :clojars}
:source-paths ["src" "assets"]
:test-paths ["test"]
:jar-exclusions [#"\.swp|\.swo|user.clj"]
:codeina {:sources ["src"]
:reader :clojurescript
:target "doc/dist/latest/api"
:src-uri "http://github.com/funcool/bide/blob/master/"
:src-uri-prefix "#L"}
:plugins [[funcool/codeina "0.5.0"]
[lein-ancient "0.6.10"]])
| (defproject funcool/bide "1.0.0-SNAPSHOT"
:description "Simple routing for ClojureScript"
:url "https://github.com/funcool/bide"
:license {:name "BSD (2-Clause)"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:dependencies [[org.clojure/clojure "1.8.0" :scope "provided"]
[org.clojure/clojurescript "1.9.227" :scope "provided"]]
:deploy-repositories {"releases" :clojars
"snapshots" :clojars}
:source-paths ["src" "assets"]
:test-paths ["test"]
:jar-exclusions [#"\.swp|\.swo|user.clj"]
:profiles
{:dev {:dependencies [[bidi "2.0.9"]]}}
:codeina {:sources ["src"]
:reader :clojurescript
:target "doc/dist/latest/api"
:src-uri "http://github.com/funcool/bide/blob/master/"
:src-uri-prefix "#L"}
:plugins [[funcool/codeina "0.5.0"]
[lein-ancient "0.6.10"]])
|
Update pretty dependency to latest version 0.1.11 | (defproject io.aviso/rook "0.1.9-SNAPSHOT"
:description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps"
:url "https://github.com/AvisoNovate/rook"
:license {:name "Apache Sofware License 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0.html"}
;; Normally we don't AOT compile; only when tracking down reflection warnings.
:profiles {:dev
{:dependencies [[ring-mock "0.1.5"]
[io.aviso/pretty "0.1.10"]
[clj-http "0.9.1"]
[speclj "3.0.2"]
[log4j "1.2.17"]]}}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.async "0.1.278.0-76b25b-alpha"]
[org.clojure/tools.logging "0.2.6"]
[ring "1.2.2"]
[ring-middleware-format "0.3.2" :exclusions [cheshire
org.clojure/tools.reader]]
[prismatic/schema "0.2.1" :exclusions [potemkin]]
[compojure "1.1.6"]]
:plugins [[speclj "3.0.2"]]
:test-paths ["spec"])
| (defproject io.aviso/rook "0.1.9-SNAPSHOT"
:description "Ruby on Rails-style resource mapping for Clojure/Compojure web apps"
:url "https://github.com/AvisoNovate/rook"
:license {:name "Apache Sofware License 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0.html"}
;; Normally we don't AOT compile; only when tracking down reflection warnings.
:profiles {:dev
{:dependencies [[ring-mock "0.1.5"]
[io.aviso/pretty "0.1.11"]
[clj-http "0.9.1"]
[speclj "3.0.2"]
[log4j "1.2.17"]]}}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.async "0.1.278.0-76b25b-alpha"]
[org.clojure/tools.logging "0.2.6"]
[ring "1.2.2"]
[ring-middleware-format "0.3.2" :exclusions [cheshire
org.clojure/tools.reader]]
[prismatic/schema "0.2.1" :exclusions [potemkin]]
[compojure "1.1.6"]]
:plugins [[speclj "3.0.2"]]
:test-paths ["spec"])
|
Change login route to use the login view | (ns todo-repl-webapp.handler
(:require [compojure.core :refer :all]
[compojure.handler :as handler]
[compojure.route :as route]
[cemerick.friend :as friend]
(cemerick.friend [workflows :as workflows]
[credentials :as credentials])
[todo-repl-webapp.views :as views]
[todo-repl-webapp.eval :as e]
[todo-repl-webapp.users :as u]
[todo-repl-webapp.web-repl :as web-repl]))
(defroutes app-routes
(GET "/" [] "Hello World")
(GET "/home" [] (views/home (web-repl/tasks)))
(POST "/eval" [evalInput]
(let [eval-result (e/evaluate evalInput)]
(println "/eval " evalInput " evals to: " eval-result)
(views/display eval-result)))
(GET "/admin" request (friend/authorize #{::admin}
"Admin page"))
(GET "/login" [] "This is a login page")
(route/resources "/")
(route/not-found "Not Found"))
(def app
(handler/site app-routes))
(def secured-app
(-> app
(friend/authenticate {:login-uri "/login"
:credential-fn
(partial credentials/bcrypt-credential-fn u/users)
:workflows [(workflows/interactive-form)]})))
| (ns todo-repl-webapp.handler
(:require [compojure.core :refer :all]
[compojure.handler :as handler]
[compojure.route :as route]
[cemerick.friend :as friend]
(cemerick.friend [workflows :as workflows]
[credentials :as credentials])
[todo-repl-webapp.views :as views]
[todo-repl-webapp.eval :as e]
[todo-repl-webapp.users :as u]
[todo-repl-webapp.web-repl :as web-repl]))
(defroutes app-routes
(GET "/" [] "Hello World")
(GET "/home" [] (views/home (web-repl/tasks)))
(POST "/eval" [evalInput]
(let [eval-result (e/evaluate evalInput)]
(println "/eval " evalInput " evals to: " eval-result)
(views/display eval-result)))
(GET "/admin" request (friend/authorize #{::admin}
"Admin page"))
(GET "/login" [] (views/login-page))
(route/resources "/")
(route/not-found "Not Found"))
(def app
(handler/site app-routes))
(def secured-app
(-> app
(friend/authenticate {:login-uri "/login"
:credential-fn
(partial credentials/bcrypt-credential-fn u/users)
:workflows [(workflows/interactive-form)]})))
|
Fix function for checking environment | (ns servisne-info.utils
(:require [environ.core :refer [env]]))
(defn production? []
(== (env :app-environment) "production")
| (ns servisne-info.utils
(:require [environ.core :refer [env]]))
(defn production? []
(== (env :app-environment) "production"))
|
Use 1.7 clojure as this is what most people will use in the future | (defproject onyx-benchmark "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
;"-Daeron.rcv.buffer.length=100000" "-Daeron.socket.so_sndbuf=320000" "-Daeron.socket.so_rcvbuf=320000" "-Daeron.term.buffer.length=131072" "-Daeron.rcv.initial.window.length=131072"]
:java-opts ["-server" "-Xmx2g" ]
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[io.netty/netty-all "4.0.25.Final"]
[org.clojure/data.fressian "0.2.0"]
[com.mdrogalis/onyx "0.6.0-SNAPSHOT"]
[riemann-clojure-client "0.3.2" :exclusions [io.netty/netty]]
[cheshire "5.4.0"]])
| (defproject onyx-benchmark "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
;"-Daeron.rcv.buffer.length=100000" "-Daeron.socket.so_sndbuf=320000" "-Daeron.socket.so_rcvbuf=320000" "-Daeron.term.buffer.length=131072" "-Daeron.rcv.initial.window.length=131072"]
:java-opts ["-server" "-Xmx2g"]
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:global-vars {*warn-on-reflection* true *assert* false}
:dependencies [[org.clojure/clojure "1.7.0-beta2"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[io.netty/netty-all "4.0.25.Final"]
[org.clojure/data.fressian "0.2.0"]
[com.mdrogalis/onyx "0.6.0-SNAPSHOT"]
[riemann-clojure-client "0.3.2" :exclusions [io.netty/netty]]
[cheshire "5.4.0"]])
|
Change version back to snapshot | ;; The Climate Corporation licenses this file to you under under the Apache
;; License, Version 2.0 (the "License"); you may not use this file except in
;; compliance with the License. You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; See the NOTICE file distributed with this work for additional information
;; regarding copyright ownership. Unless required by applicable law or agreed
;; to in writing, software distributed under the License is distributed on an
;; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
;; or implied. See the License for the specific language governing permissions
;; and limitations under the License.
(defproject com.climate/claypoole
"1.0.0"
:description "Claypoole: Threadpool tools for Clojure."
:url "http://github.com/TheClimateCorporation/claypoole/"
:license {:name "Apache License Version 2.0"
:url http://www.apache.org/licenses/LICENSE-2.0
:distribution :repo}
:min-lein-version "2.0.0"
:source-paths ["src/clj"]
:java-source-paths ["src/java"]
:pedantic? :warn
:dependencies [[org.clojure/clojure "1.6.0"]]
:plugins [[jonase/eastwood "0.2.1"]])
| ;; The Climate Corporation licenses this file to you under under the Apache
;; License, Version 2.0 (the "License"); you may not use this file except in
;; compliance with the License. You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; See the NOTICE file distributed with this work for additional information
;; regarding copyright ownership. Unless required by applicable law or agreed
;; to in writing, software distributed under the License is distributed on an
;; "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
;; or implied. See the License for the specific language governing permissions
;; and limitations under the License.
(defproject com.climate/claypoole
"1.0.0-SNAPSHOT"
:description "Claypoole: Threadpool tools for Clojure."
:url "http://github.com/TheClimateCorporation/claypoole/"
:license {:name "Apache License Version 2.0"
:url http://www.apache.org/licenses/LICENSE-2.0
:distribution :repo}
:min-lein-version "2.0.0"
:source-paths ["src/clj"]
:java-source-paths ["src/java"]
:pedantic? :warn
:dependencies [[org.clojure/clojure "1.6.0"]]
:plugins [[jonase/eastwood "0.2.1"]])
|
Bump dependency on json-path, finally with the new interface we've already been using | (defproject greenyet "1.1.0"
:description "Are my machines green yet?"
:url "https://github.com/cburgmer/greenyet"
:license {:name "BSD 2-Clause"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:plugins [[lein-ring "0.9.7"]]
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/tools.logging "0.3.1"]
[log4j/log4j "1.2.17" :exclusions [javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]
[ring/ring-core "1.4.0"]
[ring/ring-jetty-adapter "1.4.0"]
[org.clojure/core.async "0.2.374"]
[http-kit "2.1.18"]
[clj-time "0.9.0"]
[hiccup "1.0.5"]
[clj-yaml "0.4.0"]
[cheshire "5.4.0"]
[json-path "0.3.0"]]
:profiles {:dev {:dependencies [[http-kit.fake "0.2.1"]
[ring-mock "0.1.5"]]
:resource-paths ["resources" "test/resources"]
:jvm-opts ["-Dgreenyet.environment=development"]}}
:ring {:handler greenyet.core/handler
:init greenyet.core/init})
| (defproject greenyet "1.1.0"
:description "Are my machines green yet?"
:url "https://github.com/cburgmer/greenyet"
:license {:name "BSD 2-Clause"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:plugins [[lein-ring "0.9.7"]]
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/tools.logging "0.3.1"]
[log4j/log4j "1.2.17" :exclusions [javax.mail/mail
javax.jms/jms
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]
[ring/ring-core "1.4.0"]
[ring/ring-jetty-adapter "1.4.0"]
[org.clojure/core.async "0.2.374"]
[http-kit "2.1.18"]
[clj-time "0.9.0"]
[hiccup "1.0.5"]
[clj-yaml "0.4.0"]
[cheshire "5.4.0"]
[json-path "1.0.0"]]
:profiles {:dev {:dependencies [[http-kit.fake "0.2.1"]
[ring-mock "0.1.5"]]
:resource-paths ["resources" "test/resources"]
:jvm-opts ["-Dgreenyet.environment=development"]}}
:ring {:handler greenyet.core/handler
:init greenyet.core/init})
|
Prepare for next release cycle. | (defproject onyx-app/lein-template "0.9.7.0-alpha2"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-app/lein-template "0.9.7.0-SNAPSHOT"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Add criterium to dev profile | (defproject compojure "1.3.0"
:description "A concise routing library for Ring"
:url "https://github.com/weavejester/compojure"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/tools.macro "0.1.5"]
[clout "2.1.0"]
[medley "0.5.3"]
[ring/ring-core "1.3.2"]
[ring/ring-codec "1.0.0"]]
:plugins [[codox "0.8.10"]]
:codox {:src-dir-uri "http://github.com/weavejester/compojure/blob/1.3.0/"
:src-linenum-anchor-prefix "L"}
:profiles
{:dev {:dependencies [[ring-mock "0.1.5"]
[javax.servlet/servlet-api "2.5"]]}
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0-alpha2"]]}})
| (defproject compojure "1.3.0"
:description "A concise routing library for Ring"
:url "https://github.com/weavejester/compojure"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/tools.macro "0.1.5"]
[clout "2.1.0"]
[medley "0.5.3"]
[ring/ring-core "1.3.2"]
[ring/ring-codec "1.0.0"]]
:plugins [[codox "0.8.10"]]
:codox {:src-dir-uri "http://github.com/weavejester/compojure/blob/1.3.0/"
:src-linenum-anchor-prefix "L"}
:profiles
{:dev {:jvm-opts ^:replace []
:dependencies [[ring-mock "0.1.5"]
[criterium "0.4.3"]
[javax.servlet/servlet-api "2.5"]]}
:1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0-alpha2"]]}})
|
Change compilation target to 1.8 | (defproject buddy/buddy-core "1.10.0"
:description "Cryptographic Api for Clojure."
:url "https://github.com/funcool/buddy-core"
:license {:name "Apache 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:dependencies [[org.clojure/clojure "1.10.3" :scope "provided"]
[org.clojure/test.check "1.1.0" :scope "test"]
[commons-codec/commons-codec "1.15"]
[cheshire "5.10.0"]
[org.bouncycastle/bcprov-jdk15on "1.68"]
[org.bouncycastle/bcpkix-jdk15on "1.68"]]
:jar-name "buddy-core.jar"
:source-paths ["src"]
:java-source-paths ["src"]
:test-paths ["test"]
:global-vars {*warn-on-reflection* true}
:jar-exclusions [#"\.cljx|\.swp|\.swo|user.clj"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"])
| (defproject buddy/buddy-core "1.10.0"
:description "Cryptographic Api for Clojure."
:url "https://github.com/funcool/buddy-core"
:license {:name "Apache 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:dependencies [[org.clojure/clojure "1.10.3" :scope "provided"]
[org.clojure/test.check "1.1.0" :scope "test"]
[commons-codec/commons-codec "1.15"]
[cheshire "5.10.0"]
[org.bouncycastle/bcprov-jdk15on "1.68"]
[org.bouncycastle/bcpkix-jdk15on "1.68"]]
:jar-name "buddy-core.jar"
:source-paths ["src"]
:java-source-paths ["src"]
:test-paths ["test"]
:global-vars {*warn-on-reflection* true}
:jar-exclusions [#"\.cljx|\.swp|\.swo|user.clj"]
:javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"])
|
Use simple logger which uses stderr | (defproject bitcoin "0.1.0-SNAPSHOT"
:description "offline paper wallet generator"
:url "http://diegobasch.com"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"bitcoinj" "http://distribution.bitcoinj.googlecode.com/git/releases/"}
:dependencies [[org.bitcoinj/bitcoinj-core "0.12.3"]
[com.madgag/scprov-jdk15on "1.47.0.3"]
[org.clojars.dbasch/bip38 "0.1.0"]
[com.google.guava/guava "15.0"]
[org.slf4j/slf4j-api "1.7.5"]
[com.google.zxing/core "2.3.0"]
[com.google.zxing/javase "2.3.0"]
[org.clojure/clojure "1.5.1"]
[pandect "0.5.2"]]
:main bitcoin.miniwallet)
| (defproject bitcoin "0.1.0-SNAPSHOT"
:description "offline paper wallet generator"
:url "http://diegobasch.com"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"bitcoinj" "http://distribution.bitcoinj.googlecode.com/git/releases/"}
:dependencies [[org.bitcoinj/bitcoinj-core "0.12.3"]
[com.madgag/scprov-jdk15on "1.47.0.3"]
[org.clojars.dbasch/bip38 "0.1.0"]
[com.google.guava/guava "15.0"]
[org.slf4j/slf4j-simple "1.7.5"]
[com.google.zxing/core "2.3.0"]
[com.google.zxing/javase "2.3.0"]
[org.clojure/clojure "1.5.1"]
[pandect "0.5.2"]]
:main bitcoin.miniwallet)
|
Prepare for next release cycle. | (defproject onyx-plugin/lein-template "0.8.2.2"
:description "A Leiningen 2.0 template for new Onyx plugins"
:url "http://github.com/MichaelDrogalis/onyx-plugin"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-plugin/lein-template "0.8.2.3-SNAPSHOT"
:description "A Leiningen 2.0 template for new Onyx plugins"
:url "http://github.com/MichaelDrogalis/onyx-plugin"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Update lein-swank dev dependency to 1.1.0. | ;; The only requirement of the project.clj file is that it includes a
;; defproject form. It can have other code in it as well, including
;; loading other task definitions.
(defproject leiningen "1.1.0-RC1"
:description "A build tool designed not to set your hair on fire."
:url "http://github.com/technomancy/leiningen"
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"]
[ant/ant "1.6.5"]
[ant/ant-launcher "1.6.5"]
[jline "0.9.94"]
[org.apache.maven/maven-ant-tasks "2.0.10"]]
:dev-dependencies [[leiningen/lein-swank "1.0.0-SNAPSHOT"]
[autodoc "0.7.0"]]
:main leiningen.core)
| ;; The only requirement of the project.clj file is that it includes a
;; defproject form. It can have other code in it as well, including
;; loading other task definitions.
(defproject leiningen "1.1.0-RC1"
:description "A build tool designed not to set your hair on fire."
:url "http://github.com/technomancy/leiningen"
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"]
[ant/ant "1.6.5"]
[ant/ant-launcher "1.6.5"]
[jline "0.9.94"]
[org.apache.maven/maven-ant-tasks "2.0.10"]]
:dev-dependencies [[leiningen/lein-swank "1.1.0"]
[autodoc "0.7.0"]]
:main leiningen.core)
|
Remove version field from codox links | (defproject com.greenyouse/deepfns "0.1.0"
:description "Deeply nested fmap, fapply, and more!"
:url "https://github.com/greenyouse/deepfns"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.228"]]
:profiles {:dev {:dependencies
[[org.clojure/test.check "0.9.0"]
[criterium "0.4.3"]]
:plugins
[[lein-codox "0.9.1"]]}}
:codox {:source-uri "https://github.com/greenyouse/deepfns/blob/master/{version}/{filepath}#L{line}"
:include [deepfns.core deepfns.transitive deepfns.utils]})
| (defproject com.greenyouse/deepfns "0.1.0"
:description "Deeply nested fmap, fapply, and more!"
:url "https://github.com/greenyouse/deepfns"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.228"]]
:profiles {:dev {:dependencies
[[org.clojure/test.check "0.9.0"]
[criterium "0.4.3"]]
:plugins
[[lein-codox "0.9.1"]]}}
:codox {:source-uri "https://github.com/greenyouse/deepfns/blob/master/{filepath}#L{line}"
:include [deepfns.core deepfns.transitive deepfns.utils]})
|
Add lib-dev profile, for easier release to clojars | {:user {
:dependencies [[pjstadig/humane-test-output "0.6.0"]
[slamhound "1.5.5"]]
:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]
:jvm-opts ["-Xmx512m" "-server"]
:plugins [
[lein-kibit "0.1.2"]
[lein-try "0.4.3"]
[cider/cider-nrepl "0.8.2"]
[lein-ancient "0.6.7"]
[lein-pprint "1.1.1"]]}}
| {:user {
:dependencies [[pjstadig/humane-test-output "0.6.0"]
[slamhound "1.5.5"]]
:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]
:jvm-opts ["-Xmx512m" "-server"]
:plugins [
[lein-kibit "0.1.2"]
[lein-try "0.4.3"]
[cider/cider-nrepl "0.8.2"]
[lein-ancient "0.6.7"]
[lein-pprint "1.1.1"]]}
:lib-dev {
:gsub-version/files #{"README.md"}
:release-tasks [["clean"]
["vcs" "assert-committed"]
["change" "version"
"leiningen.release/bump-version" "release"]
["gsub-version"]
["vcs" "commit"]
["vcs" "tag"]
["deploy"]
["change" "version" "leiningen.release/bump-version"]
["vcs" "commit"]
["vcs" "push"]]
:plugins [
[com.gfredericks/corncob-cigar "0.1.5"]]}}
|
Make sure we always call destroy! | (ns petulant-life.main
(:import (org.lwjgl.opengl DisplayMode
Display
GL11
ContextAttribs
PixelFormat))
(:require [petulant-life.rendering :as r]))
; Defining some width and height constraints to the program.
(def width 640)
(def height 480)
; Initializing the OpenGL window.
(defn create []
(Display/setDisplayMode (DisplayMode. width height))
(Display/create (PixelFormat.)
(-> (ContextAttribs. 3 2)
(.withForwardCompatible true)
(.withProfileCore true)))
(Display/setTitle "Petulant Life")
(GL11/glClearColor 0.9 0.9 0.9 1))
; Cleaning up the LWJGL context.
(defn destroy []
(Display/destroy))
; Running the simulation / graphics.
(defn run []
(loop [running true]
(if (and running (not (Display/isCloseRequested)))
(do (GL11/glClear GL11/GL_COLOR_BUFFER_BIT)
(r/draw-rectangles [[10 10 50 50]
[70 10 50 50]
[10 70 50 50]
[70 70 50 50]] nil)
(Display/update)
(recur true))
nil)))
; Entry point.
(defn -main [& args]
(create)
(run)
(destroy))
| (ns petulant-life.main
(:import (org.lwjgl.opengl DisplayMode
Display
GL11
ContextAttribs
PixelFormat))
(:require [petulant-life.rendering :as r]))
; Defining some width and height constraints to the program.
(def width 640)
(def height 480)
; Initializing the OpenGL window.
(defn create []
(Display/setDisplayMode (DisplayMode. width height))
(Display/create (PixelFormat.)
(-> (ContextAttribs. 3 2)
(.withForwardCompatible true)
(.withProfileCore true)))
(Display/setTitle "Petulant Life")
(GL11/glClearColor 0.9 0.9 0.9 1))
; Cleaning up the LWJGL context.
(defn destroy []
(Display/destroy))
(defmacro with-cleanup [close-fn & body]
`(try
(do ~@body)
(finally
(~close-fn))))
; Running the simulation / graphics.
(defn run []
(loop [running true]
(if (and running (not (Display/isCloseRequested)))
(do (GL11/glClear GL11/GL_COLOR_BUFFER_BIT)
(r/draw-rectangles [[10 10 50 50]
[70 10 50 50]
[10 70 50 50]
[70 70 50 50]] nil)
(Display/update)
(recur true))
nil)))
; Entry point.
(defn -main [& args]
(with-cleanup destroy
(create)
(run)))
|
Add hot reloading example to edge app template | (ns {{root-ns}}.frontend.main)
(js/console.log "Hello, world")
(set! (.-innerText (js/document.getElementById "app")) "Loaded {{name}}!")
| (ns ^:figwheel-hooks {{root-ns}}.frontend.main)
(js/console.log "Hello, world")
;; This is called once
(defonce init
(do (set! (.-innerText (js/document.getElementById "app")) "Loaded {{name}}!") true))
;; This is called every time you make a code change
(defn ^:after-load reload []
(set! (.-innerText (js/document.getElementById "app")) "Reloaded {{name}}!"))
|
Fix a bug in bucket-props | (ns icecap.store.riak
(:require [clojure.core.async :as a :refer [thread]]
[clojurewerkz.welle.kv :as kv]
[icecap.store.api :refer [Store]]))
(defn riak-store
"Creates a Riak-backed store."
[conn bucket]
(reify Store
(create! [_ index blob]
(thread (kv/store conn bucket index blob)))
(retrieve [_ index]
(thread (kv/fetch-one conn bucket index)))
(delete! [_ index]
(thread (kv/delete conn bucket)))))
(defn bucket-props
"Creates some bucket props suitable for an icecap bucket.
These properties are centered around two basic ideas:
- blobs are immutable; they either exist or they don't
- reads are more common than writes (create/delete ops)
Because they're immutable, we don't need high consistency. Read
consistency is only used to determine if a blob has been deleted.
Additionally, we know that we're never going to see key collisions,
because the keys are long random strings.
"
[& {n :n :or {:n 3}}]
(let [r 1
w (- n r)]
{:n-val n
:r r
:w w
:dw w
:notfound-ok false
:basic-quorum true
:allow-mult false
:last-write-wins true}))
| (ns icecap.store.riak
(:require [clojure.core.async :as a :refer [thread]]
[clojurewerkz.welle.kv :as kv]
[icecap.store.api :refer [Store]]))
(defn riak-store
"Creates a Riak-backed store."
[conn bucket]
(reify Store
(create! [_ index blob]
(thread (kv/store conn bucket index blob)))
(retrieve [_ index]
(thread (kv/fetch-one conn bucket index)))
(delete! [_ index]
(thread (kv/delete conn bucket index)))))
(defn bucket-props
"Creates some bucket props suitable for an icecap bucket.
These properties are centered around two basic ideas:
- blobs are immutable; they either exist or they don't
- reads are more common than writes (create/delete ops)
Because they're immutable, we don't need high consistency. Read
consistency is only used to determine if a blob has been deleted.
Additionally, we know that we're never going to see key collisions,
because the keys are long random strings.
"
[& {n :n :or {n 3}}]
(let [r 1
w (- n r)]
{:n-val n
:r r
:w w
:dw w
:notfound-ok false
:basic-quorum true
:allow-mult false
:last-write-wins true}))
|
Copy my improved versions of dasherize and camelize from cake | (ns useful.string
(:use [clojure.string :only [join split capitalize]]))
(defn camelize [s & [lower]]
(let [parts (split (str s) #"-|_")]
(apply str
(if lower
(cons (first parts) (map capitalize (rest parts)))
(map capitalize parts)))))
(defn dasherize [s]
(.. (re-matcher #"\B([A-Z])" (str s))
(replaceAll "-$1")
toLowerCase))
(defn underscore [s]
(.. (re-matcher #"\B([A-Z])" (str s))
(replaceAll "_$1")
toLowerCase)) | (ns useful.string
(:use [clojure.string :only [join split capitalize]]))
(defn camelize [str]
(s/replace str
#"-(\w)"
(comp s/upper-case second))[s & [lower]])
(defn dasherize [name]
(s/replace name
#"(?<![A-Z])[A-Z]+"
(comp (partial str "-")
s/lower-case)))
(defn underscore [s]
(.. (re-matcher #"\B([A-Z])" (str s))
(replaceAll "_$1")
toLowerCase)) |
Add all function stubs for chapter 3. | (ns little-clojurer.chapter3
(:require [little-clojurer.chapter1 :refer :all])
(:require [little-clojurer.chapter2 :refer :all]))
(defn rember
"Return lst with the first instance of item removed."
[item lst]
nil)
| (ns little-clojurer.chapter3
(:require [little-clojurer.chapter1 :refer :all])
(:require [little-clojurer.chapter2 :refer :all]))
(defn rember
"Return lst with the first instance of item removed."
[item lst]
nil)
(defn firsts
"Takes a list of lists, return a list made out of first item of each sublist."
[lst]
nil)
(defn insertR
"Return lst with new inserted to the right of the first occurrence of old."
[new old lst]
nil)
(defn insertL
"Return lst with new inserted to the left of the first occurrence of old."
[new old lst]
nil)
(defn subst
"Return lst with the first occurrence of old replaced by new."
[new old lst]
nil)
(defn subst2
"Replace either the first occurrence of o1 or the first occurrence of o2 with new."
[new o1 o2 lst]
nil)
(defn multirember
"Return lst with all occurrences of item removed."
[a lst]
nil)
(defn multiinsertR
"Return lst with new inserted to the right of all occurrences of old."
[new old lst]
nil)
(defn multiinsertL
"Return lst with new inserted to the left of all occurrences of old."
[new old lst]
nil)
(defn multisubst
"Replace all occurrences of old with new."
[new old lst]
nil)
|
Fix unmatched delimiter in lumo test script | (require '[cljs.nodejs :as nodejs])
(require '[clojure.test :as test])
(require '[mikron.test]))
(nodejs/enable-util-print!)
(defmethod test/report [::test/default :summary] [{:keys [fail error] :as summary}]
(println "Test summary: " summary)
(.exit nodejs/process (if (= 0 fail error) 0 1)))
| (require '[cljs.nodejs :as nodejs])
(require '[clojure.test :as test])
(require '[mikron.test])
(nodejs/enable-util-print!)
(defmethod test/report [::test/default :summary] [{:keys [fail error] :as summary}]
(println "Test summary: " summary)
(.exit nodejs/process (if (= 0 fail error) 0 1)))
(test/run-tests 'mikron.test)
|
Correct a bug that prevented scheduled jobs fromw orking at all. | (ns metlog-vault.scheduler
(:use metlog-common.core)
(:require [clojure.tools.logging :as log]))
(defn start [ ]
(doto (it.sauronsoftware.cron4j.Scheduler.)
(.setDaemon true)
(.start)))
(defn schedule-job [ scheduler desc cron job-fn ]
(do
(log/info "Background job scheduled (cron:" cron "):" desc )
(.schedule scheduler cron
#(do
(log/info "Running scheduled job: " desc)
(exception-barrier job-fn (str "scheduled job:" desc))
(log/info "End scheduled job: " desc)))))
| (ns metlog-vault.scheduler
(:use metlog-common.core)
(:require [clojure.tools.logging :as log]))
(defn start [ ]
(doto (it.sauronsoftware.cron4j.Scheduler.)
(.setDaemon true)
(.start)))
(defn schedule-job [ scheduler desc cron job-fn ]
(let [ job-fn (exception-barrier job-fn (str "scheduled job:" desc))]
(log/info "Background job scheduled (cron:" cron "):" desc )
(.schedule scheduler cron
#(do
(log/info "Running scheduled job: " desc)
(job-fn)
(log/info "End scheduled job: " desc)))))
|
Prepare for next release cycle. | (defproject onyx-app/lein-template "0.14.1.0"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-app/lein-template "0.14.1.1-SNAPSHOT"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Update dependency org.onyxplatform/onyx to version 0.7.3-20150828_152050-gd122e3e. | (defproject org.onyxplatform/onyx-datomic "0.7.3-SNAPSHOT"
:description "Onyx plugin for Datomic"
:url "https://github.com/MichaelDrogalis/onyx-datomic"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
[org.onyxplatform/onyx "0.7.3-20150827_202930-g49ef67c"]]
:profiles {:dev {:dependencies [[midje "1.7.0"]
[com.datomic/datomic-free "0.9.5153"]]
:plugins [[lein-midje "3.1.3"]]}
:circle-ci {:jvm-opts ["-Xmx4g"]}})
| (defproject org.onyxplatform/onyx-datomic "0.7.3-SNAPSHOT"
:description "Onyx plugin for Datomic"
:url "https://github.com/MichaelDrogalis/onyx-datomic"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
^{:voom {:repo "git@github.com:onyx-platform/onyx.git" :branch "master"}}
[org.onyxplatform/onyx "0.7.3-20150828_152050-gd122e3e"]]
:profiles {:dev {:dependencies [[midje "1.7.0"]
[com.datomic/datomic-free "0.9.5153"]]
:plugins [[lein-midje "3.1.3"]]}
:circle-ci {:jvm-opts ["-Xmx4g"]}})
|
Prepare for next release cycle. | (defproject onyx-plugin/lein-template "0.8.2.1"
:description "A Leiningen 2.0 template for new Onyx plugins"
:url "http://github.com/MichaelDrogalis/onyx-plugin"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-plugin/lein-template "0.8.2.2-SNAPSHOT"
:description "A Leiningen 2.0 template for new Onyx plugins"
:url "http://github.com/MichaelDrogalis/onyx-plugin"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Add `bidi` and `yada` dependencies | (defproject com.nomistech/clojure-the-language "0.1.0-SNAPSHOT"
:dependencies [[cheshire "5.8.0"]
[com.climate/claypoole "1.1.4"]
[com.taoensso/timbre "4.10.0" :exclusions [io.aviso/pretty
org.clojure/tools.reader]]
[org.clojure/clojure "1.9.0"]
[org.clojure/core.async "0.4.474"]
[org.clojure/core.match "0.3.0-alpha5"]
[prismatic/schema "1.1.7"]
[ring/ring-json "0.4.0"]
[slingshot "0.12.2"]]
:repl-options {:init-ns user}
:profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]
[midje "1.9.1"]]
:source-paths ["dev"]
:plugins [[lein-midje "3.2.1"]]}})
| (defproject com.nomistech/clojure-the-language "0.1.0-SNAPSHOT"
:dependencies [[bidi "2.1.3" :exclusions [ring/ring-core]]
[cheshire "5.8.0"]
[com.climate/claypoole "1.1.4"]
[com.taoensso/timbre "4.10.0" :exclusions [io.aviso/pretty
org.clojure/tools.reader]]
[org.clojure/clojure "1.9.0"]
[org.clojure/core.async "0.4.474"]
[org.clojure/core.match "0.3.0-alpha5"]
[prismatic/schema "1.1.7"]
[ring/ring-json "0.4.0" :exclusions [ring/ring-core]]
[slingshot "0.12.2"]
[yada "1.2.11"]]
:repl-options {:init-ns user}
:profiles {:dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]
[midje "1.9.1" :exclusions [riddley]]]
:source-paths ["dev"]
:plugins [[lein-midje "3.2.1"]]}})
|
Prepare for next release cycle. | (defproject onyx-app/lein-template "0.10.0.0-alpha7"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-app/lein-template "0.10.0.0-SNAPSHOT"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Prepare for next release cycle. | (defproject onyx-app/lein-template "0.10.0.0-beta11"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-app/lein-template "0.10.0.0-SNAPSHOT"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Set clojure version to 1.7-beta2 | (defproject funcool/futura "0.1.0-SNAPSHOT"
:description "A basic building blocks for async programming."
:url "https://github.com/funcool/futura"
:license {:name "BSD (2 Clause)"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:dependencies [[cats "0.4.0"]
[manifold "0.1.0"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[org.reactivestreams/reactive-streams "1.0.0.RC5"]]
:deploy-repositories {"releases" :clojars
"snapshots" :clojars}
:source-paths ["src"]
:test-paths ["test"]
:jar-exclusions [#"\.swp|\.swo|user.clj"]
:javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]
:profiles {:dev {:dependencies [[org.clojure/clojure "1.7.0-beta1"]]
:codeina {:sources ["src"]
:language :clojure
:output-dir "doc/api"}
:plugins [[funcool/codeina "0.1.0-SNAPSHOT"
:exclusions [org.clojure/clojure]]]}})
| (defproject funcool/futura "0.1.0-SNAPSHOT"
:description "A basic building blocks for async programming."
:url "https://github.com/funcool/futura"
:license {:name "BSD (2 Clause)"
:url "http://opensource.org/licenses/BSD-2-Clause"}
:dependencies [[cats "0.4.0"]
[manifold "0.1.0"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[org.reactivestreams/reactive-streams "1.0.0.RC5"]]
:deploy-repositories {"releases" :clojars
"snapshots" :clojars}
:source-paths ["src"]
:test-paths ["test"]
:jar-exclusions [#"\.swp|\.swo|user.clj"]
:javac-options ["-target" "1.8" "-source" "1.8" "-Xlint:-options"]
:profiles {:dev {:dependencies [[org.clojure/clojure "1.7.0-beta2"]]
:codeina {:sources ["src"]
:language :clojure
:output-dir "doc/api"}
:plugins [[funcool/codeina "0.1.0-SNAPSHOT"
:exclusions [org.clojure/clojure]]]}})
|
Prepare for next release cycle. | (defproject onyx-app/lein-template "0.12.0.0"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-app/lein-template "0.12.0.1-SNAPSHOT"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Switch back to snapshot version. | (defproject cli4clj "1.2.0"
;(defproject cli4clj "1.2.1-SNAPSHOT"
:description "Create simple interactive CLIs for Clojure applications."
:url "https://github.com/ruedigergad/cli4clj"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[clj-assorted-utils "1.12.0"]
[jline/jline "2.14.2"]]
:global-vars {*warn-on-reflection* true}
:html5-docs-docs-dir "ghpages/doc"
:html5-docs-ns-includes #"^cli4clj.*"
:html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master"
:test2junit-output-dir "ghpages/test-results"
:test2junit-run-ant true
:main cli4clj.example
:plugins [[lein-cloverage "1.0.2"] [test2junit "1.1.3"] [lein-html5-docs "3.0.3"]]
:profiles {:repl {:dependencies [[jonase/eastwood "0.2.2" :exclusions [org.clojure/clojure]]]}}
)
| ;(defproject cli4clj "1.2.0"
(defproject cli4clj "1.2.1-SNAPSHOT"
:description "Create simple interactive CLIs for Clojure applications."
:url "https://github.com/ruedigergad/cli4clj"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[clj-assorted-utils "1.12.0"]
[jline/jline "2.14.2"]]
:global-vars {*warn-on-reflection* true}
:html5-docs-docs-dir "ghpages/doc"
:html5-docs-ns-includes #"^cli4clj.*"
:html5-docs-repository-url "https://github.com/ruedigergad/cli4clj/blob/master"
:test2junit-output-dir "ghpages/test-results"
:test2junit-run-ant true
:main cli4clj.example
:plugins [[lein-cloverage "1.0.2"] [test2junit "1.1.3"] [lein-html5-docs "3.0.3"]]
:profiles {:repl {:dependencies [[jonase/eastwood "0.2.2" :exclusions [org.clojure/clojure]]]}}
)
|
Tidy up, add an html? predicate | (ns doctopus.files.predicates
"We've got a loooot of filtering to do.
Like, a lot.")
(defmulti is-type?
"Returns true if the type of the file matches the type given."
(fn [fobj regex] (class fobj)))
(defmethod is-type? java.lang.String
[file-string type-regex]
(if (re-find type-regex file-string)
true
false))
(defmethod is-type? java.io.File
[file-handle type-regex]
(is-type? (.getPath file-handle) type-regex))
(defn markdown?
"returns true only for type files."
[file-handle]
(is-type? file-handle #"(?i)md|markdown|mdown$"
))
(defn restructured-text?
"returns true only for type files."
[file-handle]
(is-type? #"(?i)rst|rest$" (.getPath file-handle)
))
| (ns doctopus.files.predicates
"We've got a loooot of filtering to do.
Like, a lot.")
;; ### The `is-type' Multimethod
;; Dispatches on the type of an object which represents a file; returns a string
;; representation of the fully qualified path of that file, suitable for
;; regexing
(defmulti is-type?
"Returns true if the type of the file matches the type regex provided."
(fn [fobj regex] (class fobj)))
(defmethod is-type? java.lang.String
[file-string type-regex]
(if (re-find type-regex file-string)
true
false))
(defmethod is-type? java.io.File
[file-handle type-regex]
(is-type? (.getPath file-handle) type-regex))
;; ### File Predicates
;; Used for checking that an object representing a file -- whether it's a String
;; or a java.io.File -- has a particular extension
(defn markdown?
[file-handle]
(is-type? file-handle #"(?i)md|markdown|mdown$"))
(defn restructured-text?
[file-handle]
(is-type? file-handle #"(?i)rst|rest$"))
(defn html?
[file-handle]
(is-type? file-handle #"(?i)html$"))
|
Fix missing paren in test | (ns minijava.test-munch
(:use (minijava gas ir munch)
clojure.test))
(deftest test-Move-Mem-Binop
(let [
t1 (Temp (minijava.ir.temp.Temp.))
t2 (Temp (minijava.ir.temp.Temp.))
tree (Move (Mem (BinaryOp :+ (Const 2) t1)) t2)]
(is (= (select tree)
'(Movl (MEMORY t1 (CONST 2))t2))
))
| (ns minijava.test-munch
(:use (minijava gas ir munch)
clojure.test))
(deftest test-Move-Mem-Binop
(let [
t1 (Temp (minijava.ir.temp.Temp.))
t2 (Temp (minijava.ir.temp.Temp.))
tree (Move (Mem (BinaryOp :+ (Const 2) t1)) t2)]
(is (= (select tree)
'(Movl (MEMORY t1 (CONST 2))t2))
)))
|
Add ability to execute shell command | (ns ui.core
(:require [figwheel.client :as fw :include-macros true]
[reagent.core :as reagent :refer [atom]]))
(enable-console-print!)
(fw/watch-and-reload
:websocket-url "ws://localhost:3449/figwheel-ws"
:jsload-callback (fn [] (print "reloaded")))
(defonce state (atom 0))
(defn root-component []
[:div
[:p (str
"Node version is "
js/process.version)]
[:p (str
"Atom version is "
((js->clj
js/process.versions)
"atom-shell"))]
[:h1 "Hello world!"]
[:button
{:on-click #(swap! state inc)}
(str "You clicked me "
@state
" times")]])
(reagent/render
[root-component]
(.-body js/document))
| (ns ui.core
(:require [figwheel.client :as fw :include-macros true]
[reagent.core :as reagent :refer [atom]]
[clojure.string :as string]))
(enable-console-print!)
(fw/watch-and-reload
:websocket-url "ws://localhost:3449/figwheel-ws"
:jsload-callback (fn [] (print "reloaded")))
(defonce state (atom 0))
(defonce shell-result (atom ""))
(defonce command (atom ""))
(defonce proc (js/require "child_process"))
(defn run-process []
(let [[cmd & args] (string/split @command #"\s")
p (.spawn proc cmd (clj->js args))]
(.on (.-stdout p)
"data"
#(swap! shell-result (fn [v] (str % v)))))
(reset! command ""))
(defn root-component []
[:div
[:p (str
"Node version is "
js/process.version)]
[:p (str
"Atom version is "
((js->clj
js/process.versions)
"atom-shell"))]
[:h1 "Hello world!"]
[:button
{:on-click #(swap! state inc)}
(str "You clicked me "
@state
" times")]
[:p
[:form
{:on-submit (fn [e]
(run-process)
(.preventDefault e))}
[:input#command
{:type :text
:on-change (fn [e]
(reset! command
(.-value (.-target e))))
:value @command
:placeholder "type in shell command"}]]]
[:pre @shell-result]])
(reagent/render
[root-component]
(.-body js/document))
|
Replace implementation of term-frequency with frequencies function. | (ns analyze-data.tf-idf.term-frequency)
(defn term-frequency
"Return a map from term to number of times it appears in terms."
[terms]
(reduce (fn [m term] (assoc m term (inc (get m term 0)))) {} terms))
(defn calc-normalized-term-frequency
"Normalize term-frequency based on max-term-frequency."
[term-frequency max-term-frequency]
(+ 0.5 (* 0.5 (/ term-frequency max-term-frequency))))
(defn normalized-term-frequency
"Like term-frequency, but prevents bias towards longer documents. See
https://en.wikipedia.org/wiki/Tf–idf#Term_frequency_2"
[terms]
(let [term-frequencies (term-frequency terms)
max-term-frequency (apply max 0 (vals term-frequencies))
assoc-ntf (fn [m term] (assoc m
term
(calc-normalized-term-frequency
(get term-frequencies term)
max-term-frequency)))]
(reduce assoc-ntf {} terms)))
| (ns analyze-data.tf-idf.term-frequency)
(defn term-frequency
"Return a map from term to number of times it appears in terms."
[terms]
(frequencies terms))
(defn calc-normalized-term-frequency
"Normalize term-frequency based on max-term-frequency."
[term-frequency max-term-frequency]
(+ 0.5 (* 0.5 (/ term-frequency max-term-frequency))))
(defn normalized-term-frequency
"Like term-frequency, but prevents bias towards longer documents. See
https://en.wikipedia.org/wiki/Tf–idf#Term_frequency_2"
[terms]
(let [term-frequencies (term-frequency terms)
max-term-frequency (apply max 0 (vals term-frequencies))
assoc-ntf (fn [m term] (assoc m
term
(calc-normalized-term-frequency
(get term-frequencies term)
max-term-frequency)))]
(reduce assoc-ntf {} terms)))
|
Add autocomplete that queries serverside card master | (ns decktouch.card-input
(:require [reagent.core :as reagent :refer [atom]]
[ajax.core :refer [GET]]))
(def llist
[{:name "foo"}
{:name "bar"}
{:name "lol"}])
(defn card-input [the-cards]
(let [get-val #(.-value (.getElementById js/document "the-input"))
reset-input #(set! (.-value (.getElementById js/document
"the-input"))
"")
save #(let [v (-> (get-val) str clojure.string/trim)]
(do
(if-not (empty? v)
(do
(swap! the-cards conj {:name v})
(reset-input)))
false))]
[:div.ui-widget
[:form {:onSubmit #(do
(save)
false)}
[:input#the-input {:type "text"}]]]))
(defn ^:export card-input-did-mount []
(let [things (map :name llist)]
(.autocomplete (js/$ "#the-input")
(cljs.core/js-obj "source" (clj->js things)))))
(defn component [the-cards]
(reagent/create-class {:render #(card-input the-cards)
:component-did-mount card-input-did-mount}))
| (ns decktouch.card-input
(:require [reagent.core :as reagent :refer [atom]]
[ajax.core :refer [GET]]))
(defn card-input [the-cards]
(let [get-val #(.-value (.getElementById js/document "the-input"))
reset-input #(set! (.-value (.getElementById js/document
"the-input"))
"")
save #(let [v (-> (get-val) str clojure.string/trim)]
(do
(if-not (empty? v)
(do
(swap! the-cards conj {:name v})
(reset-input)))
false))]
[:div.ui-widget
[:form {:onSubmit #(do
(save)
false)}
[:input#the-input {:type "text"}]]]))
(defn ^:export card-input-did-mount []
(let [query-card-master
(fn [request response]
(let [query-url (str "../data/input/" (.-term request))]
(GET query-url {:handler #(response (.parse js/JSON %))})))]
(.autocomplete (js/$ "#the-input")
(cljs.core/js-obj "source" query-card-master
"minLength" 2))))
(defn component [the-cards]
(reagent/create-class {:render #(card-input the-cards)
:component-did-mount card-input-did-mount}))
|
Add dispatching support for exp type |
{:name "get-comparison-files"
:path ""
:repeat true
:generator true
:func (let [bam-ot-pairs (volatile! :nyi)]
(fn[eid comp-filename rep?]
(when (= @bam-ot-pairs :nyi)
(vswap! bam-ot-pairs
(fn[_] (htrs/get-comparison-files eid comp-filename rep?))))
(let [pairs @bam-ot-pairs]
(if (seq pairs)
(let [p (first pairs)]
(vswap! bam-ot-pairs (fn[_] (rest pairs)))
p)
(pg/done)))))
:description "Streaming comparison input data pairs. Each element is a vector [bams csv] where bams are the input bams to count and csv is the output file for the count matrix."
}
|
{:name "get-comparison-files"
:path ""
:repeat true
:generator true
:func (let [cmpgrps (volatile! :nyi)]
(fn[eid comp-filename opt?]
(when (= @cmpgrps :nyi)
(vswap! cmpgrps
(fn[_]
(cmn/get-comparison-files
(cmn/get-exp-info eid :exp)
eid comp-filename opt?))))
(let [grp @cmpgrps]
(if (seq grp)
(let [p (first grp)]
(vswap! cmpgrps (fn[_] (rest grp)))
p)
(pg/done)))))
:description "Streaming comparison input data grp. For RNA-Seq, each element is a vector [bams csv] where bams are the input bams to count and csv is the output file for the count matrix. For Tn-Seq, each element is a quad [t1 t2 csv ef], where t1 and t2 are the condition map files, csv the out matrix file, and ef the expansion factor."
}
|
Replace `set mapcat` to `apply union map`. | (ns smallex.reductions
(:require [clojure.walk :as walk]))
(defn- find-alias-deps
"Returns a set of alias deps, given an expression."
[expr]
(case (:type expr)
(:string :char-set) #{}
:symbol #{(:value expr)}
:op (set (mapcat find-alias-deps (:args expr)))))
(defn check-cyclic-aliases
"Given a grammar, returns an error if there is a cyclic alias. Returns nil if
the aliases aren't cyclic."
[grammar]
(let [alias-deps (into {} (for [[k v] (:aliases grammar)]
[k (find-alias-deps v)]))]
;; TODO: Topological sort here.
))
| (ns smallex.reductions
(:require [clojure.set :as set]
[clojure.walk :as walk]))
(defn- find-alias-deps
"Returns a set of alias deps, given an expression."
[expr]
(case (:type expr)
(:string :char-set) #{}
:symbol #{(:value expr)}
:op (apply set/union (map find-alias-deps (:args expr)))))
(defn check-cyclic-aliases
"Given a grammar, returns an error if there is a cyclic alias. Returns nil if
the aliases aren't cyclic."
[grammar]
(let [alias-deps (into {} (for [[k v] (:aliases grammar)]
[k (find-alias-deps v)]))]
;; TODO: Topological sort here.
))
|
Use let, not def. Fix docs | (ns riemann.keenio
"Forwards events to Keen IO"
(:require [clj-http.client :as client])
(:require [cheshire.core :as json]))
(def ^:private event-url
"https://api.keen.io/3.0/projects/")
(defn- post
"POST to Keen IO."
[collection project-id write-key request]
(def final-event-url
(str event-url project-id "/events/" collection))
(client/post final-event-url
{:body (json/generate-string request)
:query-params { "api_key" write-key }
:socket-timeout 5000
:conn-timeout 5000
:content-type :json
:accept :json
:throw-entire-message? true}))
(defn keenio
"Creates a keen adapter. Takes your Keen project id and write key, and
returns a function that accepts an event and sends it to Keen IO. The full
event will be sent.
(streams
(let [kio (keenio \"COLLECTION_NAME\", \"PROJECT_ID\" \"WRITE_KEY\")]
(where (state \"error\") kio)))"
[collection project-id, write-key]
(fn [event]
(post collection project-id write-key event)))
| (ns riemann.keenio
"Forwards events to Keen IO"
(:require [clj-http.client :as client])
(:require [cheshire.core :as json]))
(def ^:private event-url
"https://api.keen.io/3.0/projects/")
(defn- post
"POST to Keen IO."
[collection project-id write-key request]
(let [final-event-url
(str event-url project-id "/events/" collection)]
(client/post final-event-url
{:body (json/generate-string request)
:query-params { "api_key" write-key }
:socket-timeout 5000
:conn-timeout 5000
:content-type :json
:accept :json
:throw-entire-message? true})))
(defn keenio
"Creates a keen adapter. Takes your Keen project id and write key, and
returns a function that accepts an event and sends it to Keen IO. The full
event will be sent.
(streams
(let [kio (keenio \"COLLECTION_NAME\" \"PROJECT_ID\" \"WRITE_KEY\")]
(where (state \"error\") kio)))"
[collection project-id, write-key]
(fn [event]
(post collection project-id write-key event)))
|
Change url for scraping service informations | (ns servisne-info.scrape.ns-rs
(:use servisne-info.scrape.common)
(:require [net.cgrand.enlive-html :as en]
[clojure.string :as s]))
; Site description
(def info-site
{:url "http://www.021.rs"
:links-path "/novi-sad/servisne-informacije.html"})
; Private
(defn- info-page-title [html]
(s/trim (first (:content (first (en/select html [:h1.contentheading]))))))
(defn- info-page-content [html]
(apply str
(map s/trim
(en/select html [:div#content en/text-node]))))
; Public
(defn info-page [html]
{:title (info-page-title html)
:content (info-page-content html)})
(defn info-links [site html]
(map
(fn [a]
{:title (s/trim (first (:content a)))
:url (path-to-url site (:href (:attrs a)))})
(en/select
html
[:div.najava :div.leading :h2.contentheading :a])))
(defn links []
(info-links info-site (info-links-page info-site)))
| (ns servisne-info.scrape.ns-rs
(:use servisne-info.scrape.common)
(:require [net.cgrand.enlive-html :as en]
[clojure.string :as s]))
; Site description
(def info-site
{:url "http://www.021.rs"
:links-path "/Novi-Sad/Servisne-informacije"})
; Private
(defn- info-page-title [html]
(s/trim (first (:content (first (en/select html [:h1.contentheading]))))))
(defn- info-page-content [html]
(apply str
(map s/trim
(en/select html [:div#content en/text-node]))))
; Public
(defn info-page [html]
{:title (info-page-title html)
:content (info-page-content html)})
(defn info-links [site html]
(map
(fn [a]
{:title (s/trim (first (:content a)))
:url (path-to-url site (:href (:attrs a)))})
(en/select
html
[:div.najava :div.leading :h2.contentheading :a])))
(defn links []
(info-links info-site (info-links-page info-site)))
|
Add generic documentation about the project to the devcards | (ns om-mantras.docs
(:require [devcards.core :refer-macros [defcard start-devcard-ui!]]
[om-mantras.docs.selectable]
[om-mantras.docs.sortable]))
(enable-console-print!)
(start-devcard-ui!)
(defcard "# Hello again")
| (ns om-mantras.docs
(:require [devcards.core :refer-macros [defcard start-devcard-ui!]]
[om-mantras.docs.selectable]
[om-mantras.docs.sortable]))
(enable-console-print!)
(start-devcard-ui!)
(defcard
"# Om Mantras
Om Mantras are a collection of truly reusable, generic components for
Om (Next). Often, generic components are released with predefined styles,
expectations on what the data should look like, or even assumptions about
your app state and its structure.
Om Mantras make none of these assumptions. They follow three principles:
1. They come unstyled by default, but provide logical CSS classes to give
you full freedom to style them the way you want.
2. They accept generic data (either single data items or collections of them)
and allow you to extract the bits needed for items to be identified and
rendered via your own functions.
3. They operate in isolation from your app state but allow you to integrate
them into your apps by defining callbacks that can then mutate your app
state.
## Example interface
```
(sortable {:items <any ordered collection of arbitary data>
:key-fn (fn [item] <code to return a unique key for the item>)
:element-fn (fn [item] <code to return a React element for the item>)
:change-fn (fn [items] <code to do something with the reordered items>)})
```
## Usage
First, you have to add the following dependency to your project, e.g.
in `project.clj` or `build.boot`:
```
[\"om-mantras\" \"0.1.0-SNAPSHOT\"]
```
To use the components in your app, require `om-mantras.<component>` and
create components just like you would do with any other components written
using Om (Next):
```
(ns yourapp.some-ns
(:require [om-mantras.sortable :refer [sortable]]))
(defui YourComponent
Object
(render [this]
(dom/div nil
(sortable {:items ...
:key-fn ...
:element-fn ...
:change-fn ...}))))
```")
|
Add helper for generate random secret key. | (ns uxbox.main
(:require [clojure.tools.namespace.repl :as repl]
[mount.core :as mount]
[uxbox.config :as cfg]
[uxbox.migrations]
[uxbox.persistence]
[uxbox.frontend])
(:gen-class))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Development Stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- start
[]
(mount/start))
(defn- stop
[]
(mount/stop))
(defn- refresh
[]
(stop)
(repl/refresh))
(defn- refresh-all
[]
(stop)
(repl/refresh-all))
(defn- go
"starts all states defined by defstate"
[]
(start)
:ready)
(defn- reset
[]
(stop)
(repl/refresh :after 'uxbox.main/start))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Entry point (only for uberjar)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn -main
[& args]
(mount/start))
| (ns uxbox.main
(:require [clojure.tools.namespace.repl :as repl]
[mount.core :as mount]
[buddy.core.codecs :as codecs]
[buddy.core.nonce :as nonce]
[uxbox.config :as cfg]
[uxbox.migrations]
[uxbox.persistence]
[uxbox.frontend])
(:gen-class))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Development Stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn- start
[]
(mount/start))
(defn- stop
[]
(mount/stop))
(defn- refresh
[]
(stop)
(repl/refresh))
(defn- refresh-all
[]
(stop)
(repl/refresh-all))
(defn- go
"starts all states defined by defstate"
[]
(start)
:ready)
(defn- reset
[]
(stop)
(repl/refresh :after 'uxbox.main/start))
(defn make-secret
[]
(let [rdata (nonce/random-bytes 64)]
(codecs/bytes->safebase64 rdata)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Entry point (only for uberjar)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defn -main
[& args]
(mount/start))
|
Make the whole robot an atom in robot-name | (ns robot-name)
(def ^:private random (java.util.Random.))
(def ^:private letters (map char (range 65 91)))
(defn- generate-name []
(str (apply str (take 2 (shuffle letters)))
(+ 100 (.nextInt random 899))))
(defn robot []
{:name (atom (generate-name))})
(defn robot-name [robot]
@(:name robot))
(defn reset-name [robot]
(reset! (:name robot) (generate-name)))
| (ns robot-name)
(def ^:private random (java.util.Random.))
(def ^:private letters (map char (range 65 91)))
(defn- generate-name []
(str (apply str (take 2 (shuffle letters)))
(+ 100 (.nextInt random 899))))
(defn robot []
(atom {:name (generate-name)}))
(defn robot-name [robot]
(:name @robot))
(defn reset-name [robot]
(swap! robot assoc :name (generate-name)))
|
Break let statement into separate function | (ns whitman.config
(:require [clojure.data.json :as json]
[whitman.utils :as utils]))
(def ^:private default-user-agent
(str "whitman/" utils/version))
(defn ^:private format-config [cfg]
(let [user-agent (if (contains? cfg "user-agent")
(format (get cfg "user-agent") utils/version)
default-user-agent)]
(assoc cfg "user-agent" user-agent)))
(defn file-extension [path]
(let [dot (.lastIndexOf path ".")]
(if (> dot 0)
(.substring path (+ dot 1))
"")))
(defn file-format [path]
(case (file-extension path)
"ini" :ini
"json" :json
"yaml" :yml
"yml" :yml
nil))
(defmulti read-config file-format)
(defmethod read-config :json [path]
(-> path slurp json/read-str format-config))
| (ns whitman.config
(:require [clojure.data.json :as json]
[whitman.utils :as utils]))
(def ^:private default-user-agent
(str "whitman/" utils/version))
(defn ^:private user-agent [cfg]
(if (contains? cfg "user-agent")
(format (get cfg "user-agent") utils/version)
default-user-agent))
(defn ^:private format-config [cfg]
(assoc cfg "user-agent" (user-agent cfg)))
(defn file-extension [path]
(let [dot (.lastIndexOf path ".")]
(if (> dot 0)
(.substring path (+ dot 1))
"")))
(defn file-format [path]
(case (file-extension path)
"ini" :ini
"json" :json
"yaml" :yml
"yml" :yml
nil))
(defmulti read-config file-format)
(defmethod read-config :json [path]
(-> path slurp json/read-str format-config))
|
Set default clojure version to 1.7.0 | (defproject buddy/buddy-hashers "0.6.0"
:description "A collection of secure password hashers for Clojure"
:url "https://github.com/funcool/buddy-hashers"
:license {:name "Apache 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:dependencies [[org.clojure/clojure "1.6.0" :scope "provided"]
[buddy/buddy-core "0.6.0"]
[clojurewerkz/scrypt "1.2.0"]]
:source-paths ["src/clojure"]
:java-source-paths ["src/java"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:test-paths ["test"]
:profiles {:dev {:plugins [[lein-ancient "0.6.7"]]}})
| (defproject buddy/buddy-hashers "0.6.0"
:description "A collection of secure password hashers for Clojure"
:url "https://github.com/funcool/buddy-hashers"
:license {:name "Apache 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0"}
:dependencies [[org.clojure/clojure "1.7.0" :scope "provided"]
[buddy/buddy-core "0.6.0"]
[clojurewerkz/scrypt "1.2.0"]]
:source-paths ["src/clojure"]
:java-source-paths ["src/java"]
:javac-options ["-target" "1.7" "-source" "1.7" "-Xlint:-options"]
:test-paths ["test"]
:profiles {:dev {:plugins [[lein-ancient "0.6.7"]]}})
|
Prepare for next release cycle. | (defproject onyx-app/lein-template "0.10.0.0-rc1"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
| (defproject onyx-app/lein-template "0.10.0.0-SNAPSHOT"
:description "Onyx Leiningen application template"
:url "https://github.com/onyx-platform/onyx-template"
:license {:name "MIT License"
:url "http://choosealicense.com/licenses/mit/#"}
:repositories {"snapshots" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}
"releases" {:url "https://clojars.org/repo"
:username :env
:password :env
:sign-releases false}}
:plugins [[lein-set-version "0.4.1"]]
:profiles {:dev {:plugins [[lein-set-version "0.4.1"]
[lein-update-dependency "0.1.2"]
[lein-pprint "1.1.1"]]}}
:eval-in-leiningen true)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.