Skip to content

Instantly share code, notes, and snippets.

@sandbox
sandbox / index.html
Created September 5, 2015 05:21
vega: trying to get brushing to work with touch and mouse events
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vega/2.2.1/vega.min.js"></script>
</head>
<body>
<script type="text/javascript">
var brush_spec = {
{"resource":"playerdashptshotlog","parameters":{"LeagueID":"00","Season":"2012-13","SeasonType":"Regular Season","PlayerID":201935,"TeamID":0,"Outcome":null,"Location":null,"Month":0,"SeasonSegment":null,"DateFrom":null,"DateTo":null,"OpponentTeamID":0,"VsConference":null,"VsDivision":null,"GameSegment":null,"Period":0,"LastNGames":0},"resultSets":[{"name":"PtShotLog","headers":["GAME_ID","MATCHUP","LOCATION","W","FINAL_MARGIN","SHOT_NUMBER","PERIOD","GAME_CLOCK","SHOT_CLOCK","DRIBBLES","TOUCH_TIME","SHOT_DIST","PTS_TYPE","SHOT_RESULT","CLOSEST_DEFENDER","CLOSEST_DEFENDER_PLAYER_ID","CLOSE_DEF_DIST","FGM","PTS"],"rowSet":[]}]}
@sandbox
sandbox / statwing.csv
Created October 14, 2013 23:07
example csv for statwing
a b c d e
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
a b c d e
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
@sandbox
sandbox / docs.md
Created November 19, 2012 22:32 — forked from brettcvz/docs
Filepicker.io Heroku addon instructions

Filepicker.io provides file uploading and content management for developers as an add-on for Heroku.

Filepicker.io excels any time you want to add uploading or cloud file integration into your application. Worried about running into the Heroku 30-second-timeout with big files? No worries, we can handle files upward of 100GB. Need to store them on S3? Done, no questions asked.

Even better, Filepicker.io provides:

  • Integration with 17 content providers, so your users can pull in content directly from the cloud, increasing their engagement in your application. No wrestling with APIs required - one line of code and your app is set up with Dropbox, Facebook Photos, Google Drive, Instagram, and many more.
  • Powerful image processing functionality, so you can take uploads from the user and crop them to a 128x128 profile pictured centered around their face, for example
  • Stellar performance, streaming large files in parallel at speeds 4-10 times
I have two kinds of tweets, tweets with positive sentiment, and tweets with negative sentiment. Your task is to build a naive bayes classifier that distinguishes between these types of tweets.
Givens:
training set of tweets
testing set of tweets
The format of the training set will be:
<sentiment category {0=negative, 1=positive}>:<the full tweet here>
<sentiment category {0, 1}>:<the full tweet here>
def insertion_order(array)
((array.size.times.map { |i| [i.to_s, array[i]] }).sort.sort_by { |(a,b),(c,d)|
a.to_i <=> c.to_i
}).map { |a, b| b }
end