Skip to content

Instantly share code, notes, and snippets.

View ramnathv's full-sized avatar

Ramnath Vaidyanathan ramnathv

View GitHub Profile
@diegovalle
diegovalle / diet.r
Created March 9, 2010 17:18
Cluster analysis of what the world eats
########################################################
##### Author: Diego Valle Jones
##### Website: www.diegovalle.net
##### Date Created: Mon Mar 01 18:51:27 2010
########################################################
#1. For what foods are Americans and Mexicans outliers
#2. Partition the data around medoids to classify the
#countries of the world according to what they eat
library(ggplot2)
@imakewebthings
imakewebthings / deck.audio.js
Created February 21, 2012 03:39
Background audio for each slide in deck.js
/* Plays all audio elements inside a slide when the slide becomes active
and pauses them when the user navigates away. Replace pause with
whatever functionality desired (maybe pause and set currentTime to 0?) */
$(document).bind('deck.change', function(e, from, to) {
$.deck('getSlide', from).find('audio').each(function() {
this.pause && this.pause();
});
$.deck('getSlide', to).find('audio').each(function() {
this.play && this.play();
});
@kohske
kohske / demo01.Rmd
Created June 1, 2012 22:35
Rmd for slidify
```{r setup, echo = FALSE}
opts_knit$set(out.format = 'html')
opts_chunk$set(highlight = TRUE)
```
# Slidify
超簡単スライド作成
@kohske
@mmparker
mmparker / README.md
Created September 7, 2012 23:25
Table-driven plot in d3.js

Best viewed in its own window (because I haven't set up the CSS properly yet).

This is a report to enable my clinicians to easily review clinic statistics at will. Click on rows in the table to plot that statistic; click again to remove it from the plot.

Very much a work in progress, so please feel free to heap on the feedback!

Built with the rampantly awesome D3.js.

@cowboy
cowboy / stringify.js
Created September 19, 2012 13:45
JavaScript: like JSON.stringify but handles functions, good for creating arbitrary .js objects?
var stringify = function(obj, prop) {
var placeholder = '____PLACEHOLDER____';
var fns = [];
var json = JSON.stringify(obj, function(key, value) {
if (typeof value === 'function') {
fns.push(value);
return placeholder;
}
return value;
}, 2);
@ramnathv
ramnathv / automate_ghpages.md
Created October 4, 2012 19:10
Automating Github Pages Workflow

Problem

You have git repository with the following directory structure

myproject
|- source
|- docs
|- README.md
@syntagmatic
syntagmatic / README.md
Created November 15, 2012 01:43 — forked from mbostock/.block
d3 src tree

A visualization of files in the src directory of the d3 repository, based on Reingold-Tilford Tree.

Data Collection

Use git to clone a repository, then du to create a tsv with the directory contents.

git clone git://github.com/mbostock/d3.git
(echo -n 'size\tfile\n'; du -a d3) > d3.tsv

Burrow - recursive nesting

@mbostock
mbostock / .block
Last active January 13, 2017 19:31
ggplot2-Style Axis
license: gpl-3.0
@jonathanstark
jonathanstark / adding-js-programmatically.html
Last active September 29, 2021 06:48
Snippet of javascript code that will append external script files programmatically, and in order. Intended for responsive web sites where maximum progressive enhancement is desired. Don't want to make needless http requests or load external javascript on devices that can't (or shouldn't) execute javascript. Any questions/comments/suggestions gre…
<html>
<head></head>
<body>
<!-- All your kewl content goes here -->
<!-- Append javascript programatically so we don't make needless http requests -->
<script>
(function(doc){
var appendScripts = function(srcs) {
@hadley
hadley / html.r
Last active December 18, 2015 03:58
# We first start by creating a way of escaping the characters that have special
# meaning for html, while making sure we don't end up double-escaping at any
# point. The easiest way to do this is to create an S3 class that allows us to
# distinguish between regular text (that needs escaping) and html (that
# doesn't).
#
# We then write an escape method that leaves html unchanged and escapes the
# special characters (&, <, >) in ordinary text. We also add a method for lists
# for convenience