Skip to content

Instantly share code, notes, and snippets.

View dpastoor's full-sized avatar

Devin Pastoor dpastoor

  • A2-Ai
  • Rockville, MD
View GitHub Profile
@dpastoor
dpastoor / README.md
Last active August 29, 2015 14:13 — forked from dariocravero/README.md

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

@dpastoor
dpastoor / r_to_json
Created February 24, 2015 18:15
r to json`
#'@title
#'Data To JSON
#'
#'@description
#'This function convert data to JSON format
#'
#'@details
#'This function converts data to JSON format that can be used in Shiny and Highcharts
#'
#'@param data data.frame that contains data
@dpastoor
dpastoor / 2 annotations
Created April 20, 2015 03:58
geom annotate examples for labels in top left corners
annotate("text", x = -Inf, y = Inf, label = paste0("PredP =", 0.57), hjust = -0.1, vjust = 2, size = 5) +
annotate("text", x = -Inf, y = Inf, label = paste0("EqCrit =", 1), hjust = -0.1, vjust = 4, size = 5)
if headerrow .== -99
for (i, x) in enumerate(rawdat)
if any([contains(x, s) for s in ["ID", "DV"]])
headerrow = i
break
else
continue
end
end
end
@dpastoor
dpastoor / gist:eac7bd90fb5ccb50024d
Created April 22, 2015 16:22
R snippets for vim
snippet bp "Expand the shebang and add boilerplate text." b
###############################################################################
# Purpose: ${1:...}
# Author: ${2:...}
# Dependencies: ${3:...}
# Created: `date +%c`
###############################################################################
${0}
endsnippet
@dpastoor
dpastoor / folder_comparison.py
Last active August 29, 2015 14:25
compare files between folders python
*******************
import os
file_list1 = []
file_list2 = []
for top, dirs, files in os.walk('./'):
for nm in files:
file_list1.append(nm)
for top, dirs, files in os.walk('/Users/<user>/Music/iTunes/iTunes Media/Music/'):
for nm in files:
file_list2.append(nm)
@dpastoor
dpastoor / missing_files.R
Created August 27, 2015 02:00
check for missing column names
gather_idx <- match(gather_cols, names(data))
if (anyNA(gather_idx)) {
missing_cols <- paste(gather_cols[is.na(gather_idx)], collapse = ", ")
stop("Unknown column names: ", missing_cols, call. = FALSE)
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import gmail
import yagmail
from hackerutils import get_dotenv
import { domain } from 'config'
export default {
signup: async function (body, cb) {
let response = await fetch(`${domain}:8080/signup`, {
method: `POST`,
headers: {
'Content-Type': `application/json`
},
body: JSON.stringify(body)
@dpastoor
dpastoor / ref.js
Created January 18, 2016 04:12
getting ref values in react
const AddTodo = ({
onAddClick
}) => {
let input;
return (
<div>
<input ref={node => {
input = node;
}} />