Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
; which can be found in the file CPL.TXT at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
;dimensions of square world |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
(defproject semantic-gs "0.1.0-SNAPSHOT" | |
:dependencies [[org.clojure/clojure "1.5.1"] | |
[compojure "1.1.5"] | |
[garden "0.1.0-beta5"] | |
[hiccup "1.0.3"]] | |
:plugins [[lein-ring "0.8.5"]] | |
:ring {:handler semantic-gs.handler/app} | |
:profiles | |
{:dev {:dependencies [[ring-mock "0.1.5"]]}}) |
import org.scalatest._ | |
import prop._ | |
import org.scalacheck.Arbitrary._ | |
import org.scalacheck.Gen | |
/** | |
* Solutions to the ScalaCheck problem that shrinking failing values may generate | |
* invalid values, because the constraints of the generator are not respected. | |
* | |
* See also http://stackoverflow.com/questions/20037900/scalacheck-wont-properly-report-the-failing-case |
/** | |
* Verifies that a HTML content is valid. | |
* @param htmlContent the HTML content | |
* @return true if it is valid, false otherwise | |
* @throws Exception | |
*/ | |
public boolean validateHtml( String htmlContent ) throws Exception { | |
InputStream in = new ByteArrayInputStream( htmlContent.getBytes( "UTF-8" )); | |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
(advice-add 'org-clock-select-task :override #'aj/helm-org-clock-select-task) | |
(defun aj/helm-org-clock-select-task (&optional prompt) | |
"Select a task that was recently associated with clocking." | |
(interactive) | |
;; TODO sources for these | |
;; (when (marker-buffer org-clock-default-task) | |
;; (insert (org-add-props "Default Task\n" nil 'face 'bold)) | |
;; (setq s (org-clock-insert-selection-line ?d org-clock-default-task)) |
~/dev/scala/cljrepl $ cat build.sbt | |
scalaVersion := "2.11.8" | |
libraryDependencies ++= Seq( | |
"org.clojure" % "clojure" % "1.8.0" | |
) | |
~/dev/scala/cljrepl $ cat src/main/scala/foo.scala | |
import clojure.java.api.Clojure | |
import clojure.java.api.Clojure.{`var` => cvar} |
Flame graphs are a nifty debugging tool to determine where CPU time is being spent. Using the Java Flight recorder, you can do this for Java processes without adding significant runtime overhead.
Shivaram Venkataraman and I have found these flame recordings to be useful for diagnosing coarse-grained performance problems. We started using them at the suggestion of Josh Rosen, who quickly made one for the Spark scheduler when we were talking to him about why the scheduler caps out at a throughput of a few thousand tasks per second. Josh generated a graph similar to the one below, which illustrates that a significant amount of time is spent in serialization (if you click in the top right hand corner and search for "serialize", you can see that 78.6% of the sampled CPU time was spent in serialization). We used this insight to spee
I made a documentation generator that cashes in on Clojure's dynamism. See the play-cljs docs (a ClojureScript game library) for an example of its output.
Like many of you, I've often wondered what my final regret will be on my deathbed. My best guess came to me in a dream recently. I was walking across the charred earth of an apocalyptic future world, maneuvering around the remains of the less fortunate. I was startled to find a young girl, barely holding onto her life. She murmured something to me. I asked her to repeat it, and she said more loudly: "I...wish your Clojure projects didn't have such crappy documentation."