This file contains hidden or 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
#@author Bommarito Consulting, LLC; http://bommaritollc.com/ | |
#@date 20121105 | |
# Imports | |
library(RCurl) | |
library(XML) | |
# Set RCurl options | |
options(RCurlOptions = list(timeout = 10, useragent = "Mozilla/6.0 (Windows NT 6.2; WOW64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1")) |
This file contains hidden or 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
# @author: Bommarito Consulting, LLC; http://michaelbommarito.com/ | |
# @date: May 21, 2012 | |
# @email: [email protected] | |
# @packages: ggplot2, plyr | |
# Clear and import. | |
rm(list=ls()) | |
library(ggplot2) | |
library(plyr) |
This file contains hidden or 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 codecs | |
import email | |
import email.parser | |
import glob | |
import json | |
import os | |
import os.path | |
import sys | |
def parseFile(fileName): |
This file contains hidden or 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
def __repr__(self): | |
''' | |
Return string representation. | |
''' | |
skipNone = True | |
reprString = type(self).__name__ + " [" | |
elements = dir(self) | |
for e in elements: | |
# Make sure we only display "public" fields; skip anything private (_*), that is a method/function, or that is a module. |
This file contains hidden or 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
# Clear and load libraries | |
rm(list=ls()) | |
library(ggplot2) | |
library(stats) | |
# Read data | |
data <- read.csv("bills-all.csv", comment.char='') | |
# Plot and save. | |
ggplot(data) + |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template match="/code"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Michigan Compiled Law</title> | |
<style type="text/css"> | |
.chapter { |
This file contains hidden or 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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org.mjb</groupId> | |
<artifactId>uscs</artifactId> | |
<version>0.1</version> | |
<packaging>jar</packaging> | |
<name>uscs</name> |
This file contains hidden or 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
/** | |
* @author Michael J Bommarito II | |
* @date Apr 9, 2011 | |
* @license MIT, (C) Michael J Bommarito II 2011 | |
*/ | |
package org.mjb; | |
// Java standard library imports | |
import java.io.*; |
This file contains hidden or 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
/** | |
* @author Michael J Bommarito II | |
* @date Apr 9, 2011 | |
* @license MIT, (C) Michael J Bommarito II 2011 | |
*/ | |
package org.mjb; | |
// Java standard library imports | |
import java.io.*; | |
import java.util.*; |
This file contains hidden or 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
#@author Michael J Bommarito II | |
#@date Mar 12, 2011 | |
# Thanks Hadley! | |
library(ggplot2) | |
# Load the sample | |
twitterDF <- read.csv('sample.csv', header=FALSE, stringsAsFactors=FALSE) | |
# Convert Twitter dates to POSIXct objects |