Skip to content

Instantly share code, notes, and snippets.

View GraylinKim's full-sized avatar

Graylin Kim GraylinKim

View GitHub Profile
I wish the usage of gist was better documented.
This will be a version 2 revision I guess.
for post in self.objs.get('posts',[]):
def makeRef(name,value):
for obj in self.objs.get(name,[]):
if obj.slug == value:
tag.posts.append(post)
post.tags[i] = tag
return True
warning = "%s '%s' referenced but not defined."
self.log.warning(warning % (name[:-1].capitalize(),value))
<bill document="true">
<defaultsearch xml_exclude="true">S66023-2009 66023 2009 One Bill to Bind them A bit of garbage in here John Adams Jr.</defaultsearch>
<id>S66023-2009</id>
<url solr_exclude="true">/bill/S66023-2009</url>
<billnum>S66023</billnum>
<session>2009</session>
<title>One Bill to Bind them</title>
<summary>A bit of garbage in here</summary>
<text>Lots of Garbage in Here</text>
@GraylinKim
GraylinKim / redmine_commands.sh
Created November 11, 2010 16:07
Shell commands for running/stopping Redmine as a daemon via Mongrel
sudo mongrel_rails start --daemonize \
--port 8080 \
--prefix=/redmine \
--environment production \
--chdir /home/ubuntu/redmine/ \
--pid /home/ubuntu/redmine/mongrel.pid \
--log /home/ubuntu/redmine/mongrel.log
sudo pkill mongrel_rails
@GraylinKim
GraylinKim / varnish_configuration.vcl
Created November 11, 2010 16:11
The current configuration file and run command for my varnish install
#The Redmine instance running on Mongrel
backend redmine {
.host = "127.0.0.1";
.port = "8080";
}
#Will be the Lighttpd/Nginx in the future, not yet though
backend default {
.host = "127.0.0.1";
.port = "8000";
@GraylinKim
GraylinKim / example_schema.xml
Created November 16, 2010 02:14
An example schema with flags and full structure demonstrated
<bill document="true">
<defaultsearch xml_exclude="true" />
<id></id>
<url solr_exclude="true"></url>
<billnum></billnum>
<session></session>
<title></title>
<summary></summary>
<text></text>
@GraylinKim
GraylinKim / example_input.xml
Created November 16, 2010 02:15
An example document to match the example schema.
<bill>
<defaultsearch>S66023-2009 66023 2009 One Bill to Bind them A bit of garbage in here John Adams Jr.</defaultsearch>
<id>S66023-2009</id>
<url>/bill/S66023-2009</url>
<billnum>S66023</billnum>
<session>2009</session>
<title>One Bill to Bind them</title>
<summary>A bit of garbage in here</summary>
<text>Lots of Garbage in Here</text>
bill Document Fields:
========================
bill.vote.type: [committee]
bill.sponsor.lastname: [ADAMS]
bill.vote.ballot.voter.id: [ADAMS-2009]
bill.vote.date: [08-02-2010]
bill.billnum: [S66023]
bill.vote.total.nay: [2]
bill.action.id: [S66023-action-08:02:2010-REF2FINANCE, S66023-action-08:04:2010-1STREADING]
bill.vote.status: [PASSED]
bill Document Fields:
========================
bill.vote.type: [committee]
bill.sponsor.lastname: [ADAMS]
bill.vote.ballot.voter.id: [ADAMS-2009]
bill.vote.date: [08-02-2010]
bill.billnum: [S66023]
bill.vote.total.nay: [2]
bill.action.id: [S66023-action-08:02:2010-REF2FINANCE, S66023-action-08:04:2010-1STREADING]
bill.vote.status: [PASSED]
@GraylinKim
GraylinKim / interfaces.java
Created November 16, 2010 06:04
The FlagHandler and InputProcessor interfaces that plugins must implement
/* Processors directly take over creation of the output documents
* and are generally intended for use on leaf(ish) nodes and for
* making really dramatic output changes (not recommended)
*/
public interface InputProcessor {
public void processSolr(Node source, NodeState state, HashMap<String,ArrayList<String>> solr);
public Node processXml(Node inputNode, NodeState state, Document xml);
}