Skip to content

Instantly share code, notes, and snippets.

@devn
devn / gist:837859
Created February 21, 2011 22:52
mailtomutt build failure on homebrew
defn@polyglot Homebrew (master) $ brew install -v mailtomutt
==> Build Environment
CC: /usr/bin/cc => /usr/bin/gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/bin/gcc-4.2
CFLAGS: -O3 -w -pipe
CXXFLAGS: -O3 -w -pipe
MAKEFLAGS: -j4
==> Downloading http://downloads.sourceforge.net/project/mailtomutt/MailtoMutt/v0.4.1/mailtomutt-0.4.1.tar.bz2
File already downloaded and cached to /Users/defn/Library/Caches/Homebrew
@devn
devn / gist:835627
Created February 20, 2011 02:39
Factor out condp and keyed functions into updatable structures
;; I have two primary goals:
;; 1.) ...{:foo (fn ...)}... should be defined outside of the
;; function-map in a way that allows you to update :foo's (fn ...)
;; (perhaps a ref, an atom?)
;; 2.) The cases for condp: "fred", "ethel" should live in a structure
;; that can be updated as well. For instance, if I want to add "lucy"
;; (handle-lucy a b c d) to the condp I'd like to be able to do that
;; by using a separate structure to hold all of the cases for the
watch( 'test/.*\.clj' ) {|md| test_stuff }
watch( 'src/.*\.clj' ) {|md| test_stuff }
def colorize(text, color_code)
"#{color_code}#{text}\e[1;37m"
end
def red(text); colorize(text, "\e[0;31m"); end
def green(text); colorize(text, "\e[0;32m"); end
@devn
devn / model.js
Created January 28, 2011 17:11 — forked from wagenet/model.js
MyApp.MyModel.mixin({
resourcePathFor: function(action, storeKey, item) {
var id, path;
id = storeKey ? MyApp.store.idFor(storeKey) : null;
switch(action) {
case 'fetch':
case 'create':
path = 'items';
(defn quoted-string [ch]
(let [quoteSeparator (is-char ch)
stringBody (stringify (many1 (either (not-char-of #{ch \# \newline}) (not-followed-by (string "#") (string "{")))))
expressionBody (let-bind [_ (string "#{")
expr (stringify (many1 (not-char \})))
_ (string "}")]
(result (read-string expr)))
expansionBody (many (either stringBody expressionBody))
optimize (fn [exp] (if (== 2 (count exp)) (second exp) exp))]
(>>== (between quoteSeparator quoteSeparator expansionBody) #(optimize (apply list 'str %)))))
~/projects/cloby ➔ cat examples/simple.rb
require 'cloby'
class MyClojureObj < Clojure::Object
def initialize
dosync { @foo = 'foo' }
end
attr_accessor :foo
end
cc -DBUILD="\"1.3\"" -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -iquote. -c -o cmd-pipe-pane.o cmd-pipe-pane.c
cmd-pipe-pane.c: In function ‘cmd_pipe_pane_exec’:
cmd-pipe-pane.c:67: warning: implicit declaration of function ‘bufferevent_free’
cmd-pipe-pane.c:122: warning: implicit declaration of function ‘EVBUFFER_LENGTH’
cmd-pipe-pane.c:122: error: dereferencing pointer to incomplete type
cmd-pipe-pane.c:124: warning: implicit declaration of function ‘bufferevent_new’
cmd-pipe-pane.c:125: warning: assignment makes pointer from integer without a cast
cmd-pipe-pane.c:126: warning: implicit declaration of function ‘bufferevent_enable’
make: *** [cmd-pipe-pane.o] Error 1
@devn
devn / gist:725974
Created December 2, 2010 20:15
tmux build failure
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
@devn
devn / gist:671030
Created November 10, 2010 16:00
Emacs Nightly Fails to Build, OSX 10.6.4, Macbook Pro
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 ---
@devn
devn / rails_3_scope_options.rb
Created November 4, 2010 19:40
Rails 3 scope options to consider...
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)