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 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)] |
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
; 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") |
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
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 | |
} |
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
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(); |
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
<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> |
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 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)))) |
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
public class Either<T,Y> { | |
private T t; | |
private Y y; | |
public Either(T t, Y y) { | |
this.t = t; | |
this.y = y; | |
} |
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
@Component | |
@Service | |
public class PolicyRules implements RulesProvider { | |
@Override | |
public ResourceContainer[] provideRuleResources() { | |
RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess("org.drools.HelloWorldRuleSet"); | |
factory | |
// Header |
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 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); |
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
public class WhenRanAssertion implements AssertExtension { | |
private Runnable runnable; | |
private String description; | |
WhenRanAssertion(Runnable runnable) { | |
this.runnable = runnable; | |
this.description = "A runnable"; | |
} |