I've now turned this into a proper project called JShotgun. JShotgun is even faster as it uses Java 7 WatchService and reloads in a background thread.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.file.FileVisitResult; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.SimpleFileVisitor; | |
import java.nio.file.attribute.BasicFileAttributes; | |
class TempDirectory { | |
final Path path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pavo; | |
import java.io.*; | |
import java.util.*; | |
import javax.script.*; | |
public class ERB { | |
static ScriptEngine jruby = initializeJRuby(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Clojars data feeds. This needs integrating into current master branch. | |
# See: https://github.com/ato/clojars-web/blob/no-db/src/clojars/feed.clj | |
# | |
set -e | |
cd /home/clojars/repo | |
find . -name '*.pom' | grep -v '/\.' | sort > all-poms.txt.new | |
cat all-poms.txt.new | gzip > all-poms.txt.gz.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns leiningen.core.ssl | |
(:require [clojure.java.io :as io]) | |
(:import java.security.KeyStore | |
java.security.KeyStore$TrustedCertificateEntry | |
java.security.cert.CertificateFactory | |
javax.net.ssl.SSLContext | |
javax.net.ssl.TrustManagerFactory | |
javax.net.ssl.X509TrustManager)) | |
(defn ^TrustManagerFactory trust-manager-factory [^KeyStore keystore] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clj-warc.pandora2warc | |
"PANDORA display instance to WARC converter." | |
(:use clojure.java.io) | |
(:require [clojure.string :as str] | |
[clojure.contrib.seq-utils :as seq-utils]) | |
(:import (org.archive.util Base32) | |
(java.nio.file Path Files SimpleFileVisitor FileVisitResult) | |
(java.nio.file.attribute FileTime BasicFileAttributes)) | |
(:gen-class)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):010:0> (40 | |
irb(main):011:1> + 40) | |
=> 40 | |
irb(main):012:0> ("foo" | |
irb(main):013:1> + "baz") | |
NoMethodError: undefined method `+@' for "baz":String | |
from (irb):13 | |
from :0 | |
irb(main):014:0> ("foo" + | |
irb(main):015:1* "baz") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clojure.core/refer is relatively heavyweight. It gets called 7 times during Clojure | |
startup (4 times in 1.3.0). There's potential to shave off 10% of the startup time | |
by improving it. Probably even more for projects with a large number of small | |
namespaces. | |
This is just a quick experiment to see what's possible, it would need much refining. | |
It's not thread safe, doesn't print warnings and could probably be written more | |
elegantly. | |
java -Xbootclasspath/a:clojure.jar -cp clojure.jar clojure.main -e "(System/exit 0)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Maven hoopla | |
(defproject moopla "1.0.0-SNAPSHOT" | |
:dependencies [[org.clojure/clojure "1.2.0"] | |
[org.clojure/clojure-contrib "1.2.0"] | |
;; Dependency hoops! | |
[org.sonatype.aether/aether-api "1.8"] | |
[org.sonatype.aether/aether-util "1.8"] | |
[org.sonatype.aether/aether-impl "1.8"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Quick fixup of http://paste.lisp.org/display/93387 for the final | |
;; datatypes/protocols syntax. | |
;; | |
;; With subtraction fixed. | |
(defn swap-args [f] | |
(fn [x y] (f y x))) | |
(defmacro defdouble | |
"Creates a function with 2-argument type dispatch." |