This file contains hidden or 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
var handles = { | |
"AMZN":"jeffbezos", | |
"TSLA":"elonmusk", | |
"MSFT":"Microsoft", | |
"FB":"Facebook" | |
} |
This file contains hidden or 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
function sentimentAnalysis() { | |
var tweets = JSON.parse(body).statuses | |
tweets = JSON.parse(body).statuses.map(function (e) { | |
// clean tweet | |
var tweet = clean(e.text) | |
// sentiment analysis | |
var result = new Sentiment().analyze(tweet, { | |
extras: words |
This file contains hidden or 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
const fs = require('fs') | |
const request = require('request') | |
const Sentiment = require('sentiment') |
This file contains hidden or 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
function formatQuery(e) { | |
return '$' + e + handles[e] ? ' @' + e[e] : "" | |
} |
This file contains hidden or 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
var custom = { | |
'yas':3, | |
'bruh':-1, | |
'🚀': 5, | |
'🔥': 3, | |
'💩': -2 | |
} |
This file contains hidden or 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
function cleanTweet(e){ | |
return e.text | |
.replace(/\n|\r/g, "") | |
.replace(/(?:https?|ftp):\/\/[\n\S]+/g, '') // remove URLs | |
.replace(/\@[^\s]*/g, "") // remove @ mentions | |
.replace(/\$[^\s]*/g, "") // remove $ cashtags | |
.replace(/\#[^\s]*/g, "") // remove # hashtags | |
.replace('RT', '') // replace RT in retweet tweets | |
.replace('NEW', '') | |
.replace('// // ', '') |
This file contains hidden or 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
function getTweets(symbol) { | |
request({ | |
url: 'https://api.twitter.com/1.1/search/tweets.json?q=' + formatQuery(symbol), | |
headers: { 'Authorization': 'Bearer ' + TWITTER_API_KEY } | |
}, sentimentAnalysis) | |
} |
This file contains hidden or 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
// pianos | |
var leftMIDI = JZZ.input.Kbd({at:'leftMIDI' , from:'C5', to:'B5', onCreate:function() {}}); | |
var rightMIDI = JZZ.input.Kbd({at:'rightMIDI', from:'C5', to:'B5', onCreate:function() {}}); | |
var synth = JZZ.synth.Tiny(); | |
rightMIDI.connect(synth); | |
leftMIDI.connect(synth); | |
// midi out | |
var midi_out = JZZ.gui.SelectMidiOut({ at: 'midi_out' }); |
This file contains hidden or 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
function getMicrophone() { | |
} |
This file contains hidden or 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
// pythagorean tuning ratios | |
var ratio = [ | |
1/1, // unision | |
256/243, // minor second | |
9/8, // major second | |
32/27, // minor third | |
81/64, // major third | |
4/3, // perfect fourth | |
729/512, // tritone | |
3/2, // perfect fifth |
NewerOlder