Skip to content

Instantly share code, notes, and snippets.

View richardlehane's full-sized avatar
🦉
Wuz up

Richard Lehane richardlehane

🦉
Wuz up
View GitHub Profile
#include <gtk/gtk.h>
void on_destroy (GtkObject *object, gpointer user_data)
{
gtk_main_quit ();
}
int main( int argc,
char *argv[] )
{
<interface>
<object class="GtkUIManager" id="uiman">
<child>
<object class="GtkActionGroup" id="actiongroup">
<child>
<object class="GtkAction" id="file">
<property name="label">_File</property>
</object>
</child>
</object>
class PunchCard:
hourly_rate = 47.82
notify_interval = 3600.0
shift_start = 0
lunch_start = 0
lunch_mins = 0
timer = 0
def calculate_cost():
start = to_mins(shift_start)
#include "itchy.h"
int main (int argc, char* argv[]) {
char* new_doc = "<hello/>";
gtk_init(&argc, &argv);
hello = itchy_application_new();
doc = itchy_doc_new(new_doc, "hello", 0);
itchy_application_add_doc(hello, doc);
@richardlehane
richardlehane / element_matching.c
Created February 9, 2011 08:12
every rule should have a default action
MatchRule register_rule (MatchRule *rule, int type, gchar *name, (void *action)(void))
{
MatchRule new_rule;
MatchRule *next = rule;
new_rule.type = type;
new_rule->name = name;
new_rule->action = action;
new_rule->subrule = NULL;
new_rule->fails = NULL;
var InputXML = "qld_example.xml";
var WordXSL = "word_qld_authority.xsl";
function CreateWordDoc()
{
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
xmlDoc.async = false;
xmlDoc.load(InputXML);
var xsl = new ActiveXObject("Msxml2.DOMDocument.6.0");
@richardlehane
richardlehane / batch_network_drives.xsl
Created June 3, 2011 01:28
This XSL stylesheet demonstrates how a batch file can be generated to automatically create directory structures that correspond to the terms (functions and activities) of an XML authority.
<?xml version="1.0" encoding="UTF-8"?>
<!-- This XSL stylesheet demonstrates how a batch file can be generated to automatically create directory structures that correspond to the terms (functions and activities) of an XML authority. -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rda="http://www.records.nsw.gov.au/schemas/RDA" version="1.0" >
<xsl:output method="text" encoding="UTF-8"/>
<xsl:include href="include/utils.xsl"/>
<xsl:template match="/">
<xsl:apply-templates select="//rda:Term"/>
</xsl:template>
<xsl:template match="rda:Term">
<!-- the "%~dp0" creates the new directories in the directory where the batch file sits.
@richardlehane
richardlehane / timeline.rb
Created June 3, 2011 01:29
This script generates a CSV that can be used by Propublica's timeline-setter tool to make a nice timeline. It calls out to Wikipedia and Wragge's TROVE api to fill out the data provided by State Records NSW in the ministries.xml file.
#
# This script generates a CSV that can be used by Propublica's timeline-setter
# tool to make a nice timeline. It calls out to Wikipedia and Wragge's TROVE
# api to fill out the data provided by State Records NSW in the ministries.xml file.
#
#
require 'rubygems'
require 'nokogiri'
require 'net/http'
require 'date'
@richardlehane
richardlehane / MODS_changes.js
Created June 3, 2011 01:34
Suggested changes to Zotero's MODS translator
if(mods.m::location.m::shelfLocator.length()) {
// change behaviour
newItem.archiveLocation = mods.m::location.m::shelfLocator.text().toString();
newItem.archive = mods.m::location.m::physicalLocation.text().toString();
} else {
// leave as is
newItem.archiveLocation = mods.m::location.m::physicalLocation.text().toString();
}
type keyFrame struct {
Typ OffType // defined in frames.go
Min int
Max int
Alive func(int)(bool, int, int) // return L and R distances for tests
}