Skip to content

Instantly share code, notes, and snippets.

(ns tip-smtp)
(defn morph-javamail-session
"Lookup the javamail session provided by mor.ph"
[]
(.lookup (javax.naming.InitialContext.) "java:/comp/env/mail/Session"))
(defn sendmail [& optlist]
"Send an email"
(let [opts (apply hash-map optlist)]
; Convert history of the internet printable wiki into PDF
; source from http://www.nethistory.co.nz/index.php/Main_Page
(use 'clojure.contrib.str-utils)
(import '(java.io ByteArrayInputStream FileOutputStream File)
'(javax.xml.parsers DocumentBuilderFactory))
(load-file "clj_web_crawler.clj")
(System/setProperty "xr.text.aa-fontsize-threshhold" "10")
public void givenACustomerWithAUser() throws ScriptException, IOException, InterruptedException {
// do what ever is needed to create the customer, and a user, store as an instance var
}
public void editTheirOwnDetails() throws IOException {
// Do something to check the user can edit their details, throw an exception/assertion if false
}
public class EvalCommand extends AbstractCommand {
@Override
public void execute(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) {
Check.isFalse(commandCall.hasChildCommands(), "Nesting commands inside an 'eval' is not supported");
Element element = commandCall.getElement();
String evalString = element.getText();
<p>
<span smx:eval="">Given a customer with a user</span>,
that user should be able to <span smx:eval="">edit their own Details</span>.
</p>
(ns com.theoryinpractise.initial-context-factory
(:gen-class :implements [javax.naming.spi.InitialContextFactory]))
(def bindings (ref {}))
(def context
(proxy [javax.naming.InitialContext] [true]
(bind [name object] (dosync (alter bindings assoc name object)))
(unbind [name] (dosync (alter bindings dissoc name)))
(lookup [name] (get @bindings name))))
public class Either<T,Y> {
private T t;
private Y y;
public Either(T t, Y y) {
this.t = t;
this.y = y;
}
@Component
@Service
public class PolicyRules implements RulesProvider {
@Override
public ResourceContainer[] provideRuleResources() {
RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess("org.drools.HelloWorldRuleSet");
factory
// Header
package nz.co.smx.smx3.concordion;
import org.concordion.api.*;
import org.concordion.internal.ConcordionBuilder;
public class BasicConcordionRunner implements Runner {
public RunnerResult execute(Resource resource, String href) throws Exception {
Resource hrefResource = resource.getParent().getRelativeResource(href);
public class WhenRanAssertion implements AssertExtension {
private Runnable runnable;
private String description;
WhenRanAssertion(Runnable runnable) {
this.runnable = runnable;
this.description = "A runnable";
}