Skip to content

Instantly share code, notes, and snippets.

View vu3jej's full-sized avatar
🌴
On vacation

vu3jej

🌴
On vacation
View GitHub Profile
@vu3jej
vu3jej / README.md
Created October 19, 2015 11:10 — forked from mbostock/.block
Bivariate Hexbin Map

This example shows how to use the d3.hexbin plugin for hexagonal binning on a map with the d3.geo.albersUsa projection. Approximately 3,000 locations of Walmart stores are shown. These are binned into hexagons, and the hexagon area encodes the number of stores that fall into each bin. Color encodes the median age of Walmart stores in that area, with the oldest stores in black and the youngest stores in blue. Inspired by earlier work by Zachary Forest Johnson.

@vu3jej
vu3jej / horizon plot in ggplot2.r
Last active September 14, 2015 09:36 — forked from timelyportfolio/horizon plot in ggplot2.r
horizon plot in ggplot2
#first attempt at implementing horizon plots in ggplot2
#pleased with result but code sloppy and inflexible
#as always very open to improvements and forks
require(ggplot2)
require(reshape2)
require(quantmod)
require(PerformanceAnalytics)
require(xtsExtra)

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@vu3jej
vu3jej / TRAI_parser.R
Created May 5, 2015 19:35
R Script to Parse, Clean and Write TRAI emails to a CSV file
## Libraries
require(XML)
require(stringr)
## Read in the file
doc <- htmlTreeParse(file = '27 March to 10 April OTT.mbox.html', useInternalNodes = TRUE)
## Do some random crazy stuff
mail.list <- sapply(getNodeSet(doc, "//td[2]"), xmlValue)

Keybase proof

I hereby claim:

  • I am vu3jej on github.
  • I am jithesh (https://keybase.io/jithesh) on keybase.
  • I have a public key whose fingerprint is CEDA 260C C5C3 EBF1 C93F 52C0 2575 6817 D003 9D97

To claim this, I am signing this object:

@vu3jej
vu3jej / spells.py
Created March 3, 2015 21:25
Snippet from week 6 of MITx: 6.00.1x Introduction to Computer Science and Programming Using Python
class Spell(object):
def __init__(self, incantation, name):
self.name = name
self.incantation = incantation
def __str__(self):
return self.name + ' ' + self.incantation + '\n' + self.getDescription()
def getDescription(self):
return 'No description'
@vu3jej
vu3jej / kimono_modified.json
Created February 15, 2015 19:50
JSON endpoint for Kimonolabs API for http://jithe.sh/ post! A list of locations for job postings [SORTED]
{
"name": "demo1",
"count": 100,
"frequency": "Manual Crawl",
"version": 2,
"newdata": true,
"lastrunstatus": "success",
"lastsuccess": "Sun Feb 15 2015 19:10:38 GMT+0000 (UTC)",
"thisversionstatus": "success",
"thisversionrun": "Sun Feb 15 2015 19:10:38 GMT+0000 (UTC)",
@vu3jej
vu3jej / kimonoLocationSort.js
Created February 15, 2015 19:47
JS snippet to transform Kimonolabs JSON endpoints. Demo for http://jithe.sh/ post.
function transform(data) {
// Sort according to location
for(var collection in data.results) {
data.results[collection].sort(function(a, b) {
return a.location.localeCompare(b.location);
});
}
@vu3jej
vu3jej / kimono_source.json
Created February 15, 2015 19:41
JSON with locations from job postings [UNSORTED]
{
"name": "demo1",
"count": 100,
"frequency": "Manual Crawl",
"version": 2,
"newdata": true,
"lastrunstatus": "success",
"lastsuccess": "Sun Feb 15 2015 19:10:38 GMT+0000 (UTC)",
"thisversionstatus": "success",
"thisversionrun": "Sun Feb 15 2015 19:10:38 GMT+0000 (UTC)",