Skip to content

Instantly share code, notes, and snippets.

View ramnathv's full-sized avatar

Ramnath Vaidyanathan ramnathv

View GitHub Profile
@frankfarach
frankfarach / templateR.sh
Last active February 20, 2021 22:06
This shell script creates a version-controlled ProjectTemplate project and RStudio project for R code, with an option to specify the folder and project name. This clones http://github.com/frankfarach/templateR by default, but if you fork that you can override with your own user name in the second argument or by hard-coding it in.
#!/bin/bash
##############################################################################
# Name: templateR.sh
# Author: Frank Farach
# Description: Script to clone templateR repo from GitHub account,
# with options to name the local working directory and RStudio
# project. This depends on the existence of a repository called templateR
# in the GitHub account of user named in the global variable USER below.
# See: http://github.com/frankfarach/templateR
@srvanderplas
srvanderplas / jqfp.js
Last active June 17, 2023 04:58
Shiny user fingerprint (md5 hash of browser characteristics) and ip address demo. The .R files are in the working directory ("./"), the .js files must be placed in ./www/js/ to be accessible. I wrote the R code, which I will release under the same WTF license as the jqfp.js library is released under.
// Browser fingerprinting is a technique to "mark" anonymous users using JS
// (or other things). To build an "identity" of sorts the browser is queried
// for a list of its plugins, the screen size and several other things, then
// hashes them. The idea is that these bits of information produce an unique
// "fingerprint" of sorts; the more elaborate the list of data points is, the
// more unique this fingerprint becomes. And you wouldn't even need to set a
// cookie to recognize this user when she visits again.
//
// For more information on this topic consult
// [Ars Technica](http://arstechnica.com/tech-policy/news/2010/05/how-your-web-browser-rats-you-out-online.ars)
@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
@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) {
@mbostock
mbostock / .block
Last active January 13, 2017 19:31
ggplot2-Style Axis
license: gpl-3.0
@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

@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
@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);
@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.

@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