Skip to content

Instantly share code, notes, and snippets.

View seancorfield's full-sized avatar

Sean Corfield seancorfield

View GitHub Profile
<cffunction name="executeSQL" returntype="any" access="public" output="false">
<cfargument name="SQL" type="string" required="true" />
<cfargument name="parameters" default="#structNew()#" />
<cfargument name="types" default="#structNew()#" />
<cfargument name="cachedWithin" required="false" />
<cfset var query = 0 />
<cfset var result = 0 />
<cfset var generatedSQL = '/model/generatedSQL/' />
<cfparam name="variables.datasource" default="#variables.defaultDSN#" />
@seancorfield
seancorfield / gist:768347
Created January 6, 2011 18:59
cake test output for clojureql 1.0.0 against Clojure 1.3.0 alpha4 / Contrib 1.3.0 alpha3
(! 543)-> cake test
Var *db* not marked :dynamic true, setting to :dynamic. You should fix this before next release!
Var *debug* not marked :dynamic true, setting to :dynamic. You should fix this before next release!
WARNING: distinct already refers to: #'clojure.core/distinct in namespace: clojureql.test, being replaced by: #'clojureql.core/distinct
WARNING: conj! already refers to: #'clojure.core/conj! in namespace: clojureql.test, being replaced by: #'clojureql.core/conj!
WARNING: compile already refers to: #'clojure.core/compile in namespace: clojureql.test, being replaced by: #'clojureql.core/compile
WARNING: drop already refers to: #'clojure.core/drop in namespace: clojureql.test, being replaced by: #'clojureql.core/drop
WARNING: take already refers to: #'clojure.core/take in namespace: clojureql.test, being replaced by: #'clojureql.core/take
WARNING: sort already refers to: #'clojure.core/sort in namespace: clojureql.test, being replaced by: #'clojureql.core/sort
WARNING: disj! already refers to: #'clo
@seancorfield
seancorfield / gist:1064231
Created July 5, 2011 03:57
find-by-keys, built on clojure.java.jdbc
(def q
"Convert keyword to MySQL quoted entity name."
(partial sql/as-quoted-identifier \`))
(def qi
"Naming strategy for MySQL quoting and no lowercasing in results."
{ :entity (partial sql/as-quoted-str \`) :keyword identity })
(defn find-by-keys
"Given a table name (string) and a map of key/value pairs,
;; src/beta3/trial.clj:
(ns beta3.trial)
(defrecord TrialRecord [first last])
;; src/beta3/core.clj:
(ns beta3.core
;; fails if this require is removed:
(:require beta3.trial)
(:import beta3.trial.TrialRecord))
(defn- wildcard-filter
"Given a regex, return a FilenameFilter that matches."
[re]
(reify java.io.FilenameFilter
(accept [_ dir name] (not (nil? (re-find re name))))))
(defn- directory-list
"Given a directory and a regex, return a sorted seq of matching filenames."
[dir re]
(sort (.list (clojure.java.io/file dir) (wildcard-filter re))))
@seancorfield
seancorfield / gist:1617493
Created January 15, 2012 21:36
Example routes
routes = [
{ "/email/bounced/:email" = "/user/email_event/email/:email/event/bounced", hint = "Mark an email address as bounced." },
{ "/email/updated/:email" = "/user/email_event/email/:email/event/updated", hint = "Mark an email address as updated." },
{ "/email/validated/:email" = "/user/email_event/email/:email/event/validated", hint = "Mark an email address as validated." },
{ "/email/:email" = "/user/email/email/:email", hint = "Return the status of an email address." },
{ "/routes" = "/auth/routes", hint = "Returns the available routes." },
{ "/user/:id" = "/user/view/id/:id", hint = "Return information about a user." },
{ "/active" = "/site/active", hint = "Return the active site IDs." },
{ "*" = "/main/default" }
]
(defproject monads "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:repositories [["sonatype-snapshots" "https://oss.sonatype.org/content/repositories/snapshots/"]]
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/algo.monads "0.1.3-SNAPSHOT"]])
(ns webdriver.expectations.arab-slideshow
(:require [clj-webdriver.taxi :refer :all]
[expectations.scenarios :refer [expect scenario]]))
(scenario
(set-driver! {:browser :firefox} "http://dv.arablounge.com/login/logout"))
(scenario
(to "http://dv.arablounge.com/login")
(expect "Arab Dating" (text ".footer p a"))
@seancorfield
seancorfield / gist:8232204
Created January 3, 2014 03:30
Testing CFML's isClosure() and isCustomFunction() decision functions with function expressions as arguments.
<cfscript>
writeOutput("closure? " & isClosure(function() { return "yes"; }));
writeOutput("function? " & isCustomFunction(function() { return "no"; }));
</cfscript>
@seancorfield
seancorfield / gist:8285619
Created January 6, 2014 16:45
replaceNoCase() failure example
<cfprocessingdirective pageencoding="utf-8">
<cfoutput>
#replaceNoCase("LİELİELİELİE....","E","a very long string to replace E","all")#
</cfoutput>