Skip to content

Instantly share code, notes, and snippets.

@bdarcus
bdarcus / .gitconfig
Last active August 29, 2015 14:12 — forked from ShabbyX/.gitconfig
[user]
name = XXX XXX
email = XXX@XXX.XXX
[color]
ui = always
status = always
[alias]
s = status
co = checkout
ls = ls-files
class Presentation
attr_accessor :description, :date, :location, :slides
def initialize(description = nil, date = nil, location = nil, slides = nil)
@description = description
@date = date
@location = location
@slides = slides
from django.db import models
# an outline of a model for a course
# an umbrella organization (school, etc.)?
class AcademicSession(models.Model):
"""
A block of time (such as a semester) during which courses may be
offered.
"""
# scala has elegant xml parsing baked in
import scala.xml._
# load the xml file
val style = XML.loadFile("apa.csl")
# get the title
# note: while the parser is namespace-aware, it still returns a result
(style \\ "title").text
from rdflib import Namespace
from rdfalchemy import rdfSubject, rdfsSubject, rdfSingle, rdfMultiple
from rdfalchemy.orm import mapper
RS = Namespace('http://vocab.org/resourcelist/schema#')
class List(rdfSubject):
rdf_type = RS['List']
contains = rdfMultiple(RS.contains)
created = rdfSingle(RS.created)
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
$(document).ready(function() {
$(function() {
$("#TOC").tabs();
});
});
@bdarcus
bdarcus / slides.tex
Created October 19, 2009 18:20
simple background with context and simpleslides
\usemodule[simpleslides]
\usetypescriptfile[type-optical]
\setuplayout[textwidth=5in]
\definefontfeature
[default][default]
[mode=node,language=dflt,script=latn,onum=yes,tnum=yes,
expansion=quality,protrusion=quality]
@bdarcus
bdarcus / gist:221752
Created October 29, 2009 19:52
rss feeds
FEEDS = [
"http://www3.interscience.wiley.com/rss/journal/118485807",
"http://phg.sagepub.com/rss/current.xml",
"http://www.informaworld.com/ampp/rss~content=t713446924",
"http://www.informaworld.com/ampp/rss~content=t788352614",
"http://www.envplan.com/rss.cgi?journal=D",
"http://www.envplan.com/rss.cgi?journal=A",
"http://cgj.sagepub.com/rss/current.xml"
]
# mechanize
require 'rubygems'
require 'mechanize'
agent = WWW::Mechanize.new
page = agent.get('http://google.com/')
page = agent.click page.links.find { |l| l.text == 'News' }
{
"http://www.vanityfair.com": {
"author": "span.author",
"title": "span#articlehed",
"date": "span.display-date",
"periodical-title": "Vanity Fair"
}
}