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
| ;;; All Kinds of Destructuring ;;; | |
| (let [foo 1] foo) | |
| ; => 1 | |
| (let [[foo bar] [1 2 3]] [foo bar]) | |
| ; => [1 2] | |
| (let [[foo bar & baz] [1 2 3]] [foo bar baz]) | |
| ; => [1 2 (3)] |
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> (read-string (str {:hai "there" "hello" 3 5 "5"})) | |
| {:hai "there", "hello" 3, 5 "5"} |
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
| require "./lib/slugalizer/slugalizer.rb" | |
| desc "Create a new blog post" | |
| task :new_post, [:title] do |t, args| | |
| created_at = Time.now.strftime("%Y-%m-%d") | |
| slugged_title = Slugalizer.slugalize(args.title) | |
| yaml_head = "---\nlayout: post\ntitle: #{args.title}\ndate: #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}\n---\n\n" | |
| Dir.chdir("_posts") | |
| File.open("#{created_at}-#{slugged_title}.markdown", 'w') { |f| f.write(yaml_head) } |
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 jobmux.core | |
| (:require [clojure.xml :as xml] | |
| [clojure.zip :as zip] | |
| [clojure.contrib.zip-filter.xml :as zf])) | |
| (def craigslist (xml/parse "http://madison.craigslist.org/sof/index.rss")) | |
| (def ruby-jobs (xml/parse "http://feeds.feedburner.com/jobsrubynow?format=xml")) |
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
| (defn serialize [ds] | |
| (dorun (with-out-writer | |
| (java.io.File. "serialized.db") | |
| (binding [*print-dup* true] (prn ds)))) | |
| true) | |
| (defn deserialize [f] | |
| (with-open [r (PushbackReader. (FileReader. f))] | |
| (let [rec (read r)] | |
| rec))) |
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
| ;; CLOJURE ;; | |
| ;; use an up-to-date version of clojure mode (technomancy's version) | |
| (add-to-list 'load-path "~/src/clojure-mode") | |
| (add-to-list 'load-path "~/.emacs.d/elpa/slime-20100404/contrib") | |
| ;; initialize clojure-mode | |
| (require 'clojure-mode) | |
| ;; setup autoloads for .clj documents |
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
| ;; "Clojure transactions should be easy to understand if you've ever used database | |
| ;; transactions - they ensure that all actions on Refs are atomic, consistent, and | |
| ;; isolated." (http://clojure.org/refs) | |
| (def large-future-data-structure (ref {})) | |
| (def big-text (read-lines (File. "/path/to/my/file"))) | |
| ;; #"" is how you define a regex | |
| ;; dosync is required for transactions with a ref |
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
| scope :latest_by_hashtag, lambda {|hashtag| { | |
| :where => { :hashtags => hashtag }, | |
| :order_by => :tweeted_at.desc, | |
| :limit => 20 } | |
| } | |
| # OR # | |
| def self.latest_by_hashtag hashtag | |
| where(:hashtags => hashtag).order_by(:tweeted_at.desc).limit(20) |
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
| Loading /Users/defn/src/emacs-nov-2010/lisp/vc/ediff-hook.el (source)... | |
| Loading /Users/defn/src/emacs-nov-2010/lisp/tooltip.el (source)... | |
| Finding pointers to doc strings... | |
| Finding pointers to doc strings...done | |
| Dumping under the name emacs | |
| --- List of All Regions --- | |
| address size prot maxp | |
| --- List of Regions to be Dumped --- | |
| address size prot maxp | |
| --- Header Information --- |
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
| tty.c:392: warning: passing argument 2 of ‘bufferevent_write’ discards qualifiers from pointer target type | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o tty-keys.o tty-keys.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o tty-term.o tty-term.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o utf8.o utf8.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o window.o window.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o window-choose.o window-choose.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o window-clock.o window-clock.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o window-copy.o window-copy.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o xmalloc.o xmalloc.c | |
| cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o xterm-keys.o xterm-keys.c |