Skip to content

Instantly share code, notes, and snippets.

View AmeliaMN's full-sized avatar

Amelia McNamara AmeliaMN

View GitHub Profile
@AmeliaMN
AmeliaMN / PolePosition.R
Created October 17, 2012 01:04
R plotting example: Pole Position
# Data preparation
# Not included in this code snippet to respect the current proprietary nature of this research.
# Once research is to be reproduced, data preparation procedures will be made available.
#Plotting
plot(ypole, xpole, xlim=c(0.35, -0.12), ylim=c(0.15, -0.15), type="l", col="white", ylab="", xlab="", yaxt="n", xaxt="n")
axis(1, at=seq(from=0.35, to=-0.12, by=-0.05), labels=c(0.35, 0.3, 0.25, 0.2, 0.15, 0.1, 0.05, 0, -0.05, -0.1))
axis(2, at=seq(from=0.15, to=-0.15, by=-0.05), labels=c(0.15, 0.1, 0.05, 0, -0.05, -0.1, -0.15))
@AmeliaMN
AmeliaMN / DriftDirection.R
Created October 17, 2012 19:29
R plotting example: Polar Drift Direction
# Data preparation
# Not included in this code snippet to respect the current proprietary nature of this research.
# Once research is to be reproduced, data preparation procedures will be made available.
#Plotting
par(mar=c(5,4,4,5)+.1)
plot(newyears, pathtangent, type="l", col="white",xlim=c(1890, 2030), ylim=c(30, 225), xaxt="n", yaxt="n", ylab="", xlab="")
axis(1, at=seq(from=1890, to=2030, by=10))
@AmeliaMN
AmeliaMN / algebra.tex
Created October 22, 2012 17:48
LaTeX example (Beamer and TikZ): Algebraic structures
%-------------------------------------------------------------------------------
\newcommand{\efivebig}{\begin{tikzpicture}[xscale=.8,yscale=.8,line width=2pt]
\foreach \i in {1,...,5}
{ \path (\i,1) coordinate (T\i); \path (\i,0) coordinate (B\i); }
%%%%%%%
\filldraw[fill= black!12,draw=black!12,line width=4pt] (T1) -- (T5) -- (B5) -- (B1) -- (T1);
\draw[blue] (T3) .. controls +(.1,-.5) and +(-.1,-.5) .. (T4) ;
\draw[blue] (B3) .. controls +(.1,.3) and +(-.1,.3) .. (B4) ;
\draw[blue] (T1) -- (B1);
\draw[blue] (T2) -- (B2);
@AmeliaMN
AmeliaMN / boxtweets.R
Created October 22, 2012 18:15
R plotting example: Box office performance and tweets
# Data came in a series of directories named for major movies,
# each containing a variable number of files of corresponding tweets.
# Function that determines the number of tweets for a movie, given the name of the directory where the files reside.
numtweets=function(moviedir){
files=list.files(moviedir, full.names=TRUE)
x={}
howmany=0
for (i in 1:length(files)){
appending=readLines(files[i])
@AmeliaMN
AmeliaMN / ODEmovie.m
Created October 22, 2012 18:21
Matlab example: Creating a movie of ODE results
function M = longmovie2(Yfile,Tfile,x,y,n)
dbstop if error
dbstop if naninf
dbstop if warning
fid1=fopen(Yfile,'r');
fid2=fopen(Tfile,'r');
T=fread(fid2,inf,'double');
T=T.';
@AmeliaMN
AmeliaMN / recipe.py
Created October 22, 2012 18:25
Python example: Recipe parsing
#!/usr/local/bin/python
#import the modules we will be using in the code
import sys,re,os
#Create a text file to store all the recipe information
filename = "recipes.txt" #What our output file will be named
FILE = open(filename,"wr") #Opens recipes.txt and defines it readable and writable
broken=open("broken.txt","w") #Opens broken.txt and defines it to be writable
#Defining uppercase to be any line that has all uppercase letters
uppercase = "^(\s*[A-Z\s]){3,}\n";
@AmeliaMN
AmeliaMN / API.py
Created October 23, 2012 21:48
Twitter and Facebook API introduction
# Twitter API
# In order to do the authenticated version, you need to download a ton of modules.
# Once you have a specific module on your desktop, move in to your home folder.
# Then, in the terminal window, cd to the folder. Once you're inside the folder, type
# python setup.py build
# python setup.py install
# python setup.py test
@AmeliaMN
AmeliaMN / McNamaraCV.tex
Last active October 7, 2022 18:47
My CV
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This document is based on a template available at
% http://www.LaTeXTemplates.com
%
% Original author:
% Trey Hunner (http://www.treyhunner.com/)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
@AmeliaMN
AmeliaMN / CaliforniaBN.R
Created October 24, 2012 18:41
Spatial analysis of Barnes and Noble bookstores in CA
#Packages
library(fields)
library(sm)
library(spatstat)
library(splancs)
library(spatial)
library(geoR)
library(maps)
library(maptools)
@AmeliaMN
AmeliaMN / FinalPaperJSProject.js
Last active December 10, 2015 14:49
A silly take on word clouds (the mullets of the internet) which lets you paint with words from trends on twitter. Written in Paper.js
var values = {
place: 'US',
trend: null
};
var components = {
place: {
type: 'list',
label: 'Place',
options: ['US', 'World'],
onChange: function() {