Skip to content

Instantly share code, notes, and snippets.

View ramnathv's full-sized avatar

Ramnath Vaidyanathan ramnathv

View GitHub Profile
@ramnathv
ramnathv / gist:2910395
Created June 11, 2012 14:41
OECD Analysis: Simplified Code
#' Clean numerical data by removing
clean <- function(var){
type.convert(gsub("[a-zA-Z\\%\\s]", "", var))
}
oecd[,-1] <- sapply(oecd[,-1], clean)
x <- oecd[,-c(1, NCOL(oecd))]
y <- oecd[,NCOL(oecd)]
plyr:::adply(x, 2, cor, y, use = 'complete.obs')
@ramnathv
ramnathv / pandoc.sh
Created June 21, 2012 14:13
Installing Development Version of Pandoc
git clone git://github.com/jgm/pandoc
cd pandoc
cabal update
git submodule update --init # to update the templates submodule
cabal install -ftests # -fhighlighting no longer needed
cabal test
@ramnathv
ramnathv / minify
Created June 24, 2012 08:55 — forked from benpickles/minify
Swiftly concat and minify JavaScript files from the command line
#!/usr/bin/env ruby
dry_run = ARGV.delete('--dry-run')
force = ARGV.delete('--force')
if ARGV.empty?
puts <<-USAGE
minify, swiftly concat and minify JavaScript files from the command line
Pass a single argument to create a .min.js version:
@ramnathv
ramnathv / ribbons.css
Created July 12, 2012 13:36
Nice CSS Styles
/* Source: https://github.com/dciccale/css3-github-ribbon */
.ribbon- {
background-color: #121621;
color: #FF0;
top: 1.2em;
right: -3.2em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
@ramnathv
ramnathv / example1.Rmd
Created July 20, 2012 23:23
Slidify Example
---
# My First Slidify Deck
---
### Slide 1 ###
This is an unordered list

#HTML presentation tools

There are many HTML presentation tools and they are all created for slightly different reasons. Here's an overview. Please let me know if I forgot any.

##CSSS

CSS-based SlideShow System

@ramnathv
ramnathv / diagnose_error.R
Created July 22, 2012 20:14
Diagnose Slidify Error
library(markdown)
re.capture <- function(pattern, string, ...) {
rex = list(src = string, names = list(),
result = regexpr(pattern, string, perl = TRUE, ...))
for (.name in attr(rex$result, 'capture.name')) {
rex$names[[.name]] = substr(rex$src,
attr(rex$result, 'capture.start')[,.name],
attr(rex$result, 'capture.start')[,.name]
+ attr(rex$result, 'capture.length')[,.name]
@ramnathv
ramnathv / so_ggplot.Rmd
Created July 24, 2012 16:28
SO Question 1
# ggplot2 graph shows up fainter, and text smaller
```{r echo=FALSE, message=FALSE, warning=FALSE}
opts_chunk$set(fig.width=18, fig.height=10)
require(ggplot2)
```
***
# Simple Plot
@ramnathv
ramnathv / slide.html
Created July 26, 2012 14:57
Power of Templates in Slidify
<slide class="{{ classes }}" id="{{ id }}">
<hgroup>
{{{ header}}}
</hgroup>
<article>
{{{ content }}}
</article>
</slide>
@ramnathv
ramnathv / cdn.html
Created July 29, 2012 11:35
Serving Highlight.js
<script src="http://yandex.st/highlightjs/7.0/highlight.min.js"></script>
<script src="http://yandex.st/highlightjs/7.0/languages/r.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>