Skip to content

Instantly share code, notes, and snippets.

View AABoyles's full-sized avatar

Tony Boyles AABoyles

View GitHub Profile
@AABoyles
AABoyles / animatedheaRt.R
Last active August 29, 2015 13:56 — forked from jknowles/animatedheaRt
Animated Beating Heart in R
############################################################
## Title: Animated Beating Heart in R
## Author: Jared Knowles
## Forked: Tony Boyles
## Date: February 14, 2014
############################################################
library(animation)
library(ggplot2)
@AABoyles
AABoyles / pdf2txt.py
Created May 16, 2014 18:40
pdf2txt.py - Requires the Slate Library (https://github.com/timClicks/slate)
import glob, slate
for filename in glob.glob( '*.pdf' ):
with open(filename) as f:
doc = slate.PDF(f)
fileout = open(filename.rstrip('.pdf')+'.txt', 'w+')
fileout.writelines(doc)
@AABoyles
AABoyles / booze.csv
Last active August 29, 2015 14:02
buzzPerBuck
desc brand size proof price alcohol_ml shot_equiv cents_per_shot display_vol abv bpd
BEER Lionshead Pilsner 58673.8 9 84.99 2640 155.2941176 57.10376125 1/2 Keg 4.5 1.751264854
BEER Pabst 58673.8 9 89.99 2640 155.2941176 60.46320125 1/2 Keg 4.5 1.653961552
BEER Budweiser 58673.8 9 99.99 2640 155.2941176 67.18208125 1/2 Keg 4.5 1.488548854
BEER Bud Light 58673.8 8.4 99.99 2464 144.9411765 71.98080135 1/2 Keg 4.2 1.389338934
BEER Miller Lite 58673.8 8.4 99.99 2464 144.9411765 71.98080135 1/2 Keg 4.2 1.389338934
BEER Coors Light 58673.8 8.4 99.99 2464 144.9411765 71.98080135 1/2 Keg 4.2 1.389338934
BEER Yuengling Traditional Lager 58673.8 9 124.99 2640 155.2941176 83.9792813 1/2 Keg 4.5 1.190815266
BEER Michelob Ultra 58673.8 8.4 129.99 2464 144.9411765 93.5772014 1/2 Keg 4.2 1.068697592
BEER Yuengling Traditional Lager 29336.9 9 66.99 1320 77.64705882 90.0192476 1/4 Keg 4.5 1.110912076
@AABoyles
AABoyles / GDELTAccessor.R
Last active August 29, 2015 14:05
Query GDELT using Google BigQuery
library(devtools)
devtools::install_github("dplyr")
library(dplyr)
devtools::install_github("bigrquery")
library(bigrquery)
billingID <- "Insert Your Project's Billing ID Here"
gdelt <- src_bigquery(billingID, "GDELT")
events <- tbl(gdelt, "events")
@AABoyles
AABoyles / FunkyStats.js
Created August 27, 2014 20:54
FunkyStats
function htmlreplace(element){
var nodes=element.childNodes;
for(var n=0;n<nodes.length;n++){
if(nodes[n].nodeType==3){
var r=new RegExp('[pP][^A-Za-z0-9]+[vV]alue', 'gi');
if(nodes[n].textContent){
nodes[n].nodeValue=nodes[n].textContent.replace(r,'P. Funk');
}else{
nodes[n].nodeValue=nodes[n].nodeValue.replace(r,'P. Funk');
}
@AABoyles
AABoyles / rep.js
Created September 5, 2014 20:01
An implementation of R's rep function for Javascript Arrays
Array.prototype.repeat = function(times, each) {
if(!times){return this;}
if(!each){each=1;}
var that = this;
var temp=Array(each*this.length);
this.forEach(function(el, i){
for(j = 0; j < each; j++){
temp[i * each + j] = el;
}
});
@AABoyles
AABoyles / LoveOverTime.R
Created February 13, 2015 15:32
Valentine's Analysis
library(ggplot2)
data <- data.frame(
Time=1:20,
Love=cumsum(abs(rnorm(20, sd = 5)*100)))
ggplot(data,aes(Time,Love)) +
stat_smooth(se=FALSE, aes(color="Red", size=3)) +
theme(legend.position = "none",
axis.text.x = element_blank(),
<?php
/**
* PostGIS to GeoJSON
* Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc.
*
* @param string $geomfield The PostGIS geometry field *REQUIRED*
* @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)*
* @param string $fields Fields to be returned *OPTIONAL (If omitted, all fields will be returned)* NOTE- Uppercase field names should be wrapped in double quotes
* @param string $parameters SQL WHERE clause parameters *OPTIONAL*
* @param string $orderby SQL ORDER BY constraint *OPTIONAL*
@AABoyles
AABoyles / files.txt
Last active August 29, 2015 14:17
Text Mining in Python
AIED.2012.ch1.pdf
AIED.2012.ch2.pdf
AIED.2012.ch3.pdf
AIED.Appendix1.pdf
AIED.C1.pdf
AIED.C2.pdf
AIED.C3.pdf
AIED.C4.pdf
AIED.C5.pdf
AIED.C6.pdf
@AABoyles
AABoyles / icewsWeekdays.R
Created April 8, 2015 14:36
Event Distribution over Weekdays in ICEWS
if(!require("devtools")){
install.packages("devtools")
library("devtools")
}
install_github("aaboyles/phoxy")
library("phoxy")
library("data.table")
library("lubridate")
library("ggplot2")