This file contains 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
print "I'm cool" |
This file contains 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
# Model parameters | |
model_method = "gbm" | |
model_grid = expand.grid( n.trees = 5000, | |
interaction.depth = 5, | |
shrinkage = 0.03, | |
n.minobsinnode = 20) | |
extra_params = NULL | |
# Cross-validation parameters | |
do_cv = TRUE |
This file contains 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
# -*- coding: utf-8 -*- | |
import csv | |
import logging | |
from scrapy import Spider, Request | |
from scrapy.selector import Selector | |
from brainyquote.items import BrainyQuoteItem, SearchResultItem | |
pantheon_file = '../data/pantheon.tsv' | |
missing_authors_file = '../data/missing_authors.txt' | |
open(missing_authors_file, 'w') # empty the file |
This file contains 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
# Get artist network | |
# Arguments: | |
# artists_ids - list of artist ids | |
# Returns: | |
# list containing artists and edge dataframes | |
get_artist_network = function(artist_ids){ | |
# Get artists details | |
max_ids = min(MAX_NUM_ARTISTS, length(artist_ids)) | |
URI = paste0('https://api.spotify.com/v1/artists?ids=', paste(artist_ids[1:max_ids], collapse=",")) |
This file contains 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
# Javascript functions to set audio source, play and pause the audio | |
js_set_audio_src = "shinyjs.setAudioSrc = function(source){document.getElementById('audio_player').src=source};" | |
js_pause_audio = "shinyjs.pauseAudio = function(){document.getElementById('audio_player').pause()};" | |
js_play_audio = "shinyjs.playAudio = function(){document.getElementById('audio_player').play()};" | |
# Values stores the last point so we can turn off the audio | |
Values<-reactiveValues(old="Start") | |
# Preview the track when the user clicks on the graph point | |
# Pause the track if it's the same point |
This file contains 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
tracks_features_scatter <- gvisScatterChart(scatter, | |
options = list( | |
tooltip = "{isHtml:'True'}", | |
legend = | |
"none", lineWidth = 0, pointSize = 5, | |
title = "Track Features", | |
vAxis = paste0("{title:'", plot_labels[input$scatter_ycol], "'}"), | |
hAxis = paste0("{title:'", plot_labels[input$scatter_xcol], "'}"), | |
width = 1000, height = 500, | |
gvis.listener.jscode = " |
This file contains 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
library(jsonlite) # for parsing JSON | |
# Get a playlist list | |
# Arguments: | |
# user_id - string | |
# playlist_id - string | |
# Returns: | |
# list of playlist info | |
get_playlist = function(user_id, playlist_id){ | |
This file contains 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
library(httr) # for sending requests | |
# Get the Spotify token header for API calls | |
# Returns: | |
# Header for GET requests | |
get_token_header = function(){ | |
clientID = 'your client id here' | |
secret = 'your secret id here' | |
response = POST( |
NewerOlder