Skip to content

Instantly share code, notes, and snippets.


Ramnath Vaidyanathan ramnathv

View GitHub Profile
View smallberta_pretraining.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
nitingupta2 /
Last active Aug 15, 2017
Deploy a blogdown website on Netlify

Assuming you have:

  1. A website built using blogdown and Hugo
  2. Hosted on GitHub pages, a.k.a
  3. Built your blogdown website on your local machine blogdown:::serve_site(), which is generated within the public folder
  4. Sync'd your local public repository to repository in your github account

You want to deploy your website to Netlify, which supports custom domains with HTTPS:

  1. Sign up on Netlify with your GitHub account.
jennybc / polygraphing-films.R
Created Apr 9, 2016
Get polygraphing's film data into R
View polygraphing-films.R
x <- ""
characters <- read.csv(x, na.strings = c("NULL", "?"),
fileEncoding = "ISO-8859-1", stringsAsFactors = FALSE)
## some ages are clearly (negative) birth years ... oops
characters$age[!$age) & characters$age < 0] <- NA
characters$age[!$age) & characters$age > 105] <- NA
gilbert / comment-model.js
Last active Mar 31, 2018
Mithril-friendly Model Layer
View comment-model.js
var Comment = {} = Store('Comment')
Comment.fetchForPost = function (postId) {
return m.request({ method: 'GET', url: '/api/post/' + postId + '/comments' })
chroth7 /
Last active Dec 6, 2017
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:

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

benjie /
Last active Nov 27, 2018
Long Live CoffeeScript and Long Live ES6

Long Live CoffeeScript and Long Live ES6

Clearly ES6 is a huge improvement over ES5, and tools like [6to5][] allow us to use these cool features now. I was reading [Replace CoffeeScript with ES6][replace coffeescript] by [Blake Williams][] and thought it was a great summary of how ES6 solves many of the same problems that CoffeeScript solves; however I'd like to comment on a few of Blake's points and talk about why I'll be sticking with CoffeeScript.


Classes in ES6 (like many of the syntax changes in ES6) are very similar to the CoffeeScript equivalent. To support browsers that are not fully ES5 compliant (e.g. IE8-), however, we still can't really use getters/setters, so ignoring these the comparison is:

arunsrinivasan /
Last active Jul 27, 2018
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
View s3-method-dispatch.r
iclass <- function(x) {
if (is.matrix(x)) "matrix",
if (is.array(x) && !is.matrix(x)) "array",
if (is.double(x)) "double",
if (is.integer(x)) "integer",
DanHerbert /
Last active Dec 27, 2020
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

leeper / update_github.R
Last active Oct 23, 2015
Update packages if a newer version is available from GitHub
View update_github.R
update_github <-
function(ask = TRUE, ...){
installed <- installed.packages()
oldVersion <- installed[,'Version']
urls <- sapply(names(oldVersion), function(x){
d <- packageDescription(x)
You can’t perform that action at this time.