This file contains hidden or 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
#!/usr/bin/env ruby -wKU | |
JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home" | |
JAVA="#{JAVA_HOME}/bin/java" | |
GIT_ROOT=ENV['GIT_ROOT'] | |
CLJ="/opt/clojure" | |
LIB="#{GIT_ROOT}/library" | |
classpath=".:src:test:classes" + | |
":#{GIT_ROOT}/formpluslogic/fpl-clojure-util/fpl-clojure-util.jar" + | |
":#{CLJ}/swank-clojure/src/" |
This file contains hidden or 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.formpluslogic.util.test | |
(:use [clojure.test] | |
[clojure.test :only (run-tests)] | |
[com.formpluslogic.util.file_utils])) | |
(def test-dir "test") | |
(def test-file-prefix "test_") | |
(def test-file-ext ".clj") | |
(def *logging* false) |
This file contains hidden or 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
;; Use sandbar to create forms. Create routes, validate input, display error messages, | |
;; marshal form data, etc. More documentation and examples coming soon. | |
(defn password-strength [m] | |
(if (< (count (:password m)) 10) | |
(add-validation-error m :password properties) | |
m)) | |
(def validator | |
(build-validator |
This file contains hidden or 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
(def properties | |
{:username "Username" | |
:password "Password"}) | |
(def security-policy | |
[#"/admin.*" :admin | |
#"/permission-denied.*" :any | |
#"/login.*" :any | |
#".*\.(css|js|png|jpg|gif)$" :any | |
#".*" #{:admin :user}]) |
This file contains hidden or 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
$(function() { | |
$("#hire-date").datepicker({dateFormat: 'yy-mm-dd'}); | |
}); |
This file contains hidden or 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
$(function() { | |
$("#hire-date").datepicker({dateFormat: 'yy-mm-dd'}); | |
$("#language").autocomplete({source: "langs-autocomplete"}); | |
}); |
This file contains hidden or 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
div.sandbar-field { | |
position: relative; | |
} | |
div.sandbar-form div.error-message { | |
height: 24px; | |
padding-left: 24px; | |
background: url(../images/warning.png) no-repeat 4px -2px; | |
color: red; | |
vertical-align: bottom; |
This file contains hidden or 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
$(function() { | |
$("#hire-date").datepicker({dateFormat: 'yy-mm-dd'}); | |
$("#language").autocomplete({source: "langs-starting-with"}); | |
$("#name").blur(function() { | |
validateField("name"); | |
}); | |
This file contains hidden or 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
user=> (use 'leibniz.derivative) | |
nil | |
user=> (def y '(* (+ (* 3 ?x) 4) (+ (* 4 ?x) 6))) | |
#'user/y | |
user=> (def fy (f [?x] y)) | |
#'user/fy | |
user=> (fy 7) | |
850 | |
user=> (deriv y ?x) | |
(+ (* 24 ?x) 34) |
This file contains hidden or 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
{-# LANGUAGE TypeSynonymInstances #-} | |
class TwoOf a where | |
twoOf :: String -> a | |
instance TwoOf Bool where | |
twoOf str = length str >= 2 | |
instance TwoOf String where | |
twoOf str = take 2 str |
OlderNewer