Skip to content

Instantly share code, notes, and snippets.

View GeertVL-zz's full-sized avatar
💭
Working full time in Azure technologies

Geert Van Laethem GeertVL-zz

💭
Working full time in Azure technologies
View GitHub Profile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@swannodette
swannodette / example-user.clj
Created May 4, 2012 11:39 — forked from nijikokun/example-user.js
Beautiful Validation... Why have I never thought of this before?!
(defn validates-credentials [username password]
(let [uc (count username)
pc (count password)]
(match [username uc password pc]
[(:or nil "") _ _ _] {:error "No username given" :field "name"}
[_ _ (:or nil "") _] {:error "No password given" :field "pass"}
[_ (_ :guard #(< % 3)) _ _] {:error "Username less than 3 characters" :field "pass"}
[_ _ _ (_ :guard #(< % 4))] {:error "Password less than 4 characters" :field "pass"}
[#"^([a-z0-9-_]+)$" _ _ _] {:error "Username contains invalid characters" :field "name"}
:else true)))