Skip to content

Instantly share code, notes, and snippets.

View joshuamiller's full-sized avatar

Joshua Miller joshuamiller

View GitHub Profile
user=> (defn big[n] (> n 2))
#'user/big
user=> (filter big '(1 2 3))
(3)
$ 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 \
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... }
@joshuamiller
joshuamiller / flavor.rb
Last active March 23, 2017 22:35 — forked from ttscoff/flavor.rb
#!/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