20 Clojure Links To Get You Up To Speed 6
Posted by Matt Sears on Saturday June, 06 2009
Writing multi-threaded code is hard. If you've ever done concurrent programming, you'll probably agree. Clojure offers a compelling alternative to traditional object-oriented approaches to programming and has garnered much attention from the Ruby community because of it's elegant design that lets you get right to the essence of a problem.
What is Clojure?
Simply put, Clojure is a functional programming language for the Java Virtual Machine with several powerful features for building concurrent applications. In addition, Clojure is fast, robust, and a powerful general-purpose programming language. A dialect of Lisp, Clojure embraces traditional code-as-data philosophy and a powerful macro system, plus some syntactic sugar tailored to Java.
Now that version 1.0 is out and Stuart Halloway's new book Programming Clojure just dropped, I've rounded up some of the best articles and tutorials on Clojure to you get you up to speed quickly.
Tutorials and Links
A Clojure Tutorial by R. Mark Volkmann
Programming Clojure book by Stuart Halloway
Practical Common Lisp to Clojure by Stuart Halloway
Clojure Series: Table of Contents by Eric Rochester
Learning Clojure via Wikibooks
Clojure Programming/Examples/API Examples via Wikibooks
Clojure Programming/Tutorials and Tips via Wikibooks
Screencasts, Videos, and Presentations
Functional Programming with Clojure by Phil Hagelberg (PeepCode)
Clojure Series on Blip.tv by Rich Hickey
Intro to Clojure by Brian Will (YouTube)
Emacs with Clojure, Slime and Swank by Seth Buntin (Vimeo)
Tools and Setup
Basic Clojure Setup by Telman Yusupov
Setting Up Clojure for Mac OS X Leopard by Mark Reid
Getting Emacs setup to write Clojure code by Phil Hagelberg
Textmate Bundle for Clojure code by Scott Fleckenstein
Documentation
Clojure Coding Guidelines by Mark Volkmann
Quick git add, commit, push, and deploy 0
Posted by Matt Sears on Monday August, 11 2008
Last week, I was preparing a presentation and found myself doing a lot of quick fixes and deployments to prepare a web application for a demonstration. I thought instead of running the following four commands each time:
git add .
git commit -a -m 'A description of the change'
git push
cap production deploy
It would be nice if I could do all of the above with just one command. So I created this shell script:
push() {
# Defaults
MINLEN=25
DIRTY=false
DEPLOY="production deploy"
REMOTE_REPO = "origin master"
# Check if we have any untracked files
if git status | grep -q "modified:"
then
DIRTY=true
fi
# Make sure there is a message with the commit
if [ -z "$1" ] && (test $DIRTY == true)
then
echo "You must specify a message with your commit"
return
elif [ ${#1} -lt $MINLEN ] && (test $DIRTY == true)
then
echo "Your message must have at least $MINLEN letters."
return
fi
# Commit all the changes by default
if (test $DIRTY == true)
then
echo "Adding new files to Git repository"
git add .
echo "Commiting to local Git repository"
git commit -a -m "$1"
# Push changes if a remote repository exists
if git remote | grep -q "origin"
then
echo "Pushing changes to remote repository"
git push $REMOTE_REPO
fi
fi
# Deploy changes via Capistrano
if ls | grep -q Capfile
then
cap $DEPLOY
fi
}
The 'push' function will first check to make sure you supplied a description if any recent changes were made. Second, it will commit all the code and push it to the remote repository (if one exists).
If none of the code was modified or added, it will skip the Git commands and simply run the Capistrano deploy command and not require a description for the changes.
To use this script, copy and paste the above function to the end of your ~/.bash_profile file. To run it, simply run the 'push' command.
push "The description for the committed changes."
That's it! All the code is added, commited, pushed, and deployed.