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
(require '[clojure.xml :as xml] | |
'[clojure.zip :as zip] | |
'[clojure.contrib.zip-filter.xml :as zfx]) | |
(def reddit-rss-xml (xml/parse "http://www.reddit.com/.rss")) | |
(def zipped-xml (zip/xml-zip reddit-rss-xml)) | |
;; xml1-> treats keywords as "search for this tag." xml/node at the | |
;; end says "return me that one part of the XML map" (format specified |
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
import java.util.HashMap; | |
public class EmptyCollectionMap extends HashMap { | |
Class collectionType; | |
public EmptyCollectionMap(Class collectionType) { | |
super(); | |
this.collectionType = collectionType; | |
} |
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
print "hello world" |
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
In one window: | |
$ python2.6 /tmp/wsgiexample.py | |
In another: | |
$ curl http://localhost:9977 | |
POST some text to me. | |
$ curl -d 'This is xxx a test.' http://localhost:9977 | |
I found 3 X(es). |
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
\documentclass{article} | |
\usepackage{tabularx} | |
\newenvironment{tableenv}[0]{% | |
\tabularx{1\linewidth}{|l|X|}% | |
}{% | |
\endtabularx% | |
} |
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=> replace | |
#<core$replace clojure.core$replace@175bc6c8> | |
user=> split | |
java.lang.Exception: Unable to resolve symbol: split in this context (NO_SOURCE_FILE:0) | |
user=> (use '[clojure.string :as s :only (replace split)]) | |
WARNING: replace already refers to: #'clojure.core/replace in namespace: user, being replaced by: #'clojure.string/replace | |
nil | |
user=> replace | |
#<string$replace clojure.string$replace@4245c97b> | |
user=> split |
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
# Put this in a file and run it like "python yourscript.py name_of_your_file.csv". | |
import sys | |
import csv | |
csv_file_obj = csv.reader(open(sys.argv[1], "rb"), dialect=csv.excel_tab) | |
first_row = csv_file_obj.next() | |
# first_row is now a list of column names, we hope. Feel free to print it out. | |
print "CREATE TABLE tablename (%s);" % (", ".join("%s TEXT" % (name,) for name in first_row),) |
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/env python | |
import sys | |
import re | |
import argparse | |
CSI = "\033[" | |
RESET = CSI + "0m" | |
COLORS = dict((name, value) for value, name |
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
vimkill () { | |
local temp_file | |
temp_file=$(mktemp -t vimkillXXXXXXXXXX) | |
if [ $? -ne 0 ]; then | |
echo "mktemp failed" >&2 | |
return 1 | |
fi | |
if ! pgrep -fl "$@" > "$temp_file"; then | |
rm "$temp_file" | |
echo "no matching processes found" >&2 |
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
;; The desire for this is obvious once you use comment-dwim-2, but the | |
;; implementation ideas come from a comment by Fuco1 (author of | |
;; smartparens AFAIK) on | |
;; http://endlessparentheses.com/a-comment-or-uncomment-sexp-command.html. | |
;; Artur's code there breaks on uncommenting when there's a nearby | |
;; string with ";" in it, e.g. (untested simplified test case for the | |
;; problem I experienced): | |
;; | |
;; (define-key blah "M-;" #'foo) | |
;; |
OlderNewer