Skip to content

Instantly share code, notes, and snippets.

View ramnathv's full-sized avatar

Ramnath Vaidyanathan ramnathv

View GitHub Profile
@ramnathv
ramnathv / README.md
Last active April 8, 2022 11:17
Parser to Convert Markdown to CTV file.

This is a proof-of-concept of a parser to convert a markdown file to a ctv file, that is required for task views. The basic idea is to use a combination of YAML and markdown sections in the md file, parse it and convert it into a payload, and render it using a template as specified by the ctv package.

Structure of Markdown File

---
name: Working with data on the web
maintainer: Scott Chamberlain, Karthik Ram, Christopher Gandrud
email: scott at ropensci.org
version: 2013-09-17
"""
Remove *all* default, hard-coded, CSS classes and inline styling attached to tables when calling df.to_html(),
and add your own classes to each tag ad hoc.
This will probably be extremely simple in the future when the styling API is more mature. For now, we bleach it.
May need to `conda install bleach` or `pip install bleach`
"""
import pandas as pd
@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) {
@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
@leeper
leeper / update_github.R
Last active February 2, 2021 22:56
Update packages if a newer version is available from GitHub
library('devtools')
library('utils')
library('httr')
update_github <-
function(ask = TRUE, ...){
installed <- installed.packages()
oldVersion <- installed[,'Version']
urls <- sapply(names(oldVersion), function(x){
d <- packageDescription(x)
@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();
});
@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

@arunsrinivasan
arunsrinivasan / tweet_reply.md
Last active July 27, 2018 04:38
automatic indexing vs between() on integer ranges

Updated June 16 with latest devel

data.table's automatic indexing:

Generating some data first:

# R version 3.3.0
require(data.table) ## 1.9.7, commit 2433, github
require(dplyr) ## devel, commit 3189, github
@gilbert
gilbert / comment-model.js
Last active March 31, 2018 19:38
Mithril-friendly Model Layer
var Comment = {}
Comment.store = Store('Comment')
Comment.fetchForPost = function (postId) {
return m.request({ method: 'GET', url: '/api/post/' + postId + '/comments' })
.then(Comment.store.syncAll)
}
@chroth7
chroth7 / reactD3rescources.md
Last active December 6, 2017 05:37
React/D3 Resources

React <-> D3 Resources

Thanks for all the stars.

Due to unexpected demand, I move this to a proper github repo, see here: https://github.com/chroth7/reactD3resources

I would very much like to get your PRs there, thank you!