Skip to content

Instantly share code, notes, and snippets.

Vincent Nijs vnijs

  • Rady School of Management, UCSD
  • San Diego, CA
Block or report user

Report or block vnijs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vnijs
vnijs / .tmux.conf
Created Dec 26, 2018 — forked from CSaratakij/.tmux.conf
Tmux's Config that's very close to i3wm (Setting with an idea of using tmux without x-server)
View .tmux.conf
# Config that is very close to a i3 window manager's keybinding.
set -s escape-time 0
setw -g aggressive-resize on
# First remove *all* keybindings
unbind-key -a
# List keys
bind-key ? list-keys
@vnijs
vnijs / server.R
Last active Aug 29, 2015
Example of selectize drag-and-drop in Shiny 0.12.2.9000 or higher
View server.R
library(shiny)
library(DT)
dat <- mtcars
shinyServer(function(input, output, session) {
output$ui_view_vars <- renderUI({
vars <- colnames(dat)
## using selectizeInput with drag_drop and DT
View server.R
shinyServer(function(input, output, session) {
# On startup, read the URL parameter
queryParams <- parseQueryString(isolate(session$clientData$url_search))
if ('tab' %in% names(queryParams))
updateTabsetPanel(session, 'tabset', selected = paste0('tab', queryParams[['tab']]))
})
@vnijs
vnijs / cc.Rmd
Created Jun 8, 2015
Cold call list
View cc.Rmd
---
output: html_document
runtime: shiny
---
``` {r, echo=FALSE}
library(knitr)
suppressMessages(library(dplyr))
rady_class <- c("heroins")
```
@vnijs
vnijs / batch2sqlite.R
Last active Dec 27, 2016
Reading a csv file into an sqlite database in chunks
View batch2sqlite.R
library(dplyr)
library(readr)
library(DBI)
library(RSQLite)
read.csv2sqlite <- function(csv_file, sqlite_file, table_name, batch_size = 10000) {
## establish a connection to the database
condb <- dbConnect(SQLite(), sqlite_file)
View google_maps_with_rvest
library(dplyr); library(httr); library(rvest)
addr <- "Big Ben"
GET("http://maps.google.com/maps/api/geocode/xml",
query = list(address = addr)) %>%
content() %>%
html_nodes(xpath = "//location//lat | //location//lng") %>%
html_text() %>%
setNames(c("lng", "lat"))
View gist:8c47f4810873c8738756
dat <- data.frame(x = rep(1:3,2),
y = c(3,1,NA,3,NA,6))
dat_org <- dat
ind <- complete.cases(dat)
model <- lm(y ~ x, data = dat[ind,])
dat$res <- NA
dat[ind,"res"] <- model$res
View csv2sqlite.R
library(DBI)
library(RSQLite)
library(readr)
library(dplyr)
#=========================================================================
# Read a CSV file in chunks and stuff into a database.
#
# Note: This is proof-of-concept code only.
# It should work OK, but there are no guarantees.
View server.R
library(shiny)
library(magrittr)
shinyServer(function(input, output, session) {
#__________________________________________________________________________________
# The main named list that will be used in many other tasks.
listN <- reactiveValues()
#__________________________________________________________________________________
View server.R
# server.R
library("shiny")
shinyServer(
function(input, output, session) {
# Debug Area
output$Console <- renderUI({
You can’t perform that action at this time.