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
user=> (defn big[n] (> n 2)) | |
#'user/big | |
user=> (filter big '(1 2 3)) | |
(3) |
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
$ cat $(which clojure) | |
BREAK_CHARS="(){}[],^%$#@\"\";:''|\\" | |
CLOJURE_JARS="/opt/jars/*" | |
CP="/opt/clojure/clojure.jar:/opt/clojure/clojure-contrib.jar:$CLOJURE_JARS" | |
# If no file is being passed, start the REPL | |
if [ -z "$1" ]; then | |
rlwrap --remember -c -b $BREAK_CHARS -f $HOME/.clj_completions \ |
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
def create | |
respond_to do |format| | |
if @my_model.save | |
format.json do | |
render :json => @my_model.to_json(:methods => [:owner_name]) #owner_name is a method that returns owner.display_name | |
end | |
end | |
format html { ... } | |
else | |
format.json { errors... } |
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
#!/usr/bin/ruby | |
# encoding: US-ASCII | |
# Convert a Markdown README to HTML with Github Flavored Markdown | |
# Github and Pygments styles are included in the output | |
# | |
# Requirements: json gem (`gem install json`) | |
# | |
# Input: STDIN or filename | |
# Output: STDOUT | |
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file |