Skip to content

Instantly share code, notes, and snippets.

## Sentiment analysis for whole dataset; get sentiment mean score for every movie
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import pandas as pd
import math
def get_sentiment_score():
sid = SentimentIntensityAnalyzer()
sentiment_review = []
sentiment_mean = []
for i in range(0, len(reviews)):
output$map1 <- renderLeaflet({
leaflet() %>%
setView(lng=-112.0356, lat=33.50975, zoom=10) %>%
addTiles() %>%
addMarkers(data = dataset %>% filter(attributes.Ambience.hipster),
lng = ~longitude,
lat = ~latitude,
popup = paste(sep="<br/>",
paste(as.vector(dataset$name), ", Stars:", as.vector(dataset$stars)),
paste0(as.vector(dataset$full_address)),
@Tingting-Chang
Tingting-Chang / densityMap.R
Last active February 5, 2017 03:12
Yelp shiny app server.R
output$map2 <- renderPlot({
ggmap(get_googlemap(center = "phoenix, AZ",
zoom = 12,
maptype = "roadmap",
scale = 2)) +
geom_density2d(data = phx,
mapping = aes(x = longitude, y = latitude),
color = "black") +
stat_density2d(data = phx,
mapping = aes(x = longitude, y = latitude,
@Tingting-Chang
Tingting-Chang / hipsterRatio.R
Last active February 5, 2017 03:44
Yelp shiny app ui.R file
hipster <- dataset %>%
filter(attributes.Ambience.hipster == TRUE) %>%
group_by(categories) %>%
summarise(total = sum(attributes.Ambience.hipster), stars = mean(stars)) %>%
arrange(desc(total))
noise <- dataset %>%
mutate(noisy = ifelse(attributes.Noise.Level =='loud' |
attributes.Noise.Level== 'very_loud', T, F)) %>%

WHAT IF you could magically have livereload on every (static html) project, without any setup?

You can 🎉🎉🎉

What tools are involved

Foreman - helps you run multiple commands at once. Its name in node is nf = node-foreman. (it was originally a Ruby gem). Procfile - is what foreman uses to run its multiple commands SimpleHTTPServer - a super-common way to run a local server (so you can see files at localhost:8000) browser-sync - awesome package. Our goal! It does both live reloading AND allows you to view files from another device. When files are changed, it will auto-refresh the page. You can access these files even from your phone (as long as you are on the same wifi network), by using the url they give you called "External". You will see this url after you run nf.