Skip to content

Instantly share code, notes, and snippets.

View marsimaria's full-sized avatar

Maria Fang marsimaria

View GitHub Profile
@marsimaria
marsimaria / spearsNYTimes.py
Last active August 29, 2015 14:18
Britney Spears feat. New York Times
import sys
import re
import json
import random
s = []
from nytimesarticle import articleAPI
for i in range(0, 100):
api = articleAPI('74548056debe1698254a3a07babc9f84:3:60371965')
@marsimaria
marsimaria / network.R
Created April 1, 2015 13:55
Network Analysis
library(igraph)
library(plyr)
# load files into tables
orb.edge <- read.csv("/Users/mariafang/Desktop/NYU/2_AncientData/Week9 Network/orbis_edges_0514.csv")
orb.node <- read.csv("/users/mariafang/Desktop/NYU/2_AncientData/Week9 Network/orbis_nodes_0514.csv")
# merge tables in two
orb.tb1 <- merge(orb.edge, orb.node, by.x="source", by.y="id")
orb.tb2 <- merge(orb.edge, orb.node, by.x="target", by.y="id")
@marsimaria
marsimaria / sunflower.py
Last active August 29, 2015 14:17
Sunflower Movement Declaration Extract
# Google transalte library
import goslate
gs = goslate.Goslate()
# Import sunflower.txt
with open('sunflower.txt', 'r') as f:
text = f.read()
# print text
# Make new list "l"
# Mapping Roman Amphitheater data
## Time series plots of capacity & extmajor. Leaflet with both the outline of the roman empire & locations of amphitheaters. And testing htmlwidget with ramphs capacity.
---
title: "CumRamphs"
author: "Maria Fang"
date: "March 10, 2015"
output: html_document
---
```{r plot}
@marsimaria
marsimaria / ramphs.json
Created February 25, 2015 15:49
Test ramphs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marsimaria
marsimaria / AntisocialDO.txt
Created February 25, 2015 07:04
Mixing a list of words into Britney's song
Antisocial personality disorder signs and symptoms may include:
Disregard for right and wrong
Persistent lying or deceit to exploit others
Using charm or wit to manipulate others for personal gain or for sheer personal pleasure
Intense egocentrism, sense of superiority and exhibitionism
Recurring difficulties with the law
Repeatedly violating the rights of others by the use of intimidation, dishonesty and misrepresentation
Child abuse or neglect
Hostility, significant irritability, agitation, impulsiveness, aggression or violence
@marsimaria
marsimaria / R Arc Diagram example
Last active August 29, 2015 14:15
R: Twin Peaks S1Ep1-3 Arc Diagram
# Download arcdiagram package from Gaston Sanchez's github
install.packages("devtools")
library(devtools)
install_github("arcdiagram", username = "gastonstat")
library(arcdiagram)
# Start igraph package to use certain parameters
library(igraph)
# Convert csv file to gml -> for arc diagram use
@marsimaria
marsimaria / index.html
Created February 11, 2015 17:53
ramphs+alex
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta charset="utf-8">
<style type="text/css">
html { height: 100% ; font-size: small}
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas {min-height: 100%;height:auto; }
@marsimaria
marsimaria / index.html
Created February 11, 2015 17:42
alexander extent
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta charset="utf-8">
<style type="text/css">
html { height: 100% ; font-size: small}
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas {min-height: 100%;height:auto; }
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<script src="data:application/x-javascript,%28function%28%29%20%7B%0A%20%20%2F%2F%20If%20window%2EHTMLWidgets%20is%20already%20defined%2C%20then%20use%20it%3B%20otherwise%20create%20a%0A%20%20%2F%2F%20new%20object%2E%20This%20allows%20preceding%20code%20to%20set%20options%20that%20affect%20the%0A%20%20%2F%2F%20initialization%20process%20%28though%20none%20currently%20exist%29%2E%0A%20%20window%2EHTMLWidgets%20%3D%20window%2EHTMLWidgets%20%7C%7C%20%7B%7D%3B%0A%0A%20%20%2F%2F%20See%20if%20we%27re%20running%20in%20a%20viewer%20pane%2E%20If%20not%2C%20we%27re%20in%20a%20web%20browser%2E%0A%20%20var%20viewerMode%20%3D%20window%2EHTMLWidgets%2EviewerMode%20%3D%0A%20%20%20%20%20%20%2F%5Cbviewer%5Fpane%3D1%5Cb%2F%2Etest%28window%2Elocation%29%3B%0A%0A%20%20%2F%2F%20See%20if%20we%27re%20running%20in%20Shiny%20mode%2E%20If%20not%2C%20it%27s%20a%20static%20document%2E%0A%20%20%2F%2F%20Note%20that%20static%20widgets%20can%20appear%20in%20both%20Shiny%20and%20static