Skip to content

Instantly share code, notes, and snippets.

--Configuration, adjust to your document set up
set tocStart to 3 --Start the Table of Contents at page ...
set tocLineHeight to 15.0 --Line height
set tocSeparatorlineOffset to -5 -- Adjust separatorline (play around with this)
set tocFont to "Arial" -- Get your font by using the "Copy as applescript" function in OG and substract the right font
set tocFontSize to 10 --Font size
set tocFontColor to {0.4, 0.4, 0.4}
set tocTop to 60 --Top (y) positioning from canvas
set tocLeft to 10 --Left (x) positioning from canvas
########################################################
# Set up RStudio and JAGS on an Amazon EC2 instance
# Using Ubuntu 64-bit
# Partially from http://blog.yhathq.com/posts/r-in-the-cloud-part-1.html
# See yhat for EC2 instance set up
########################################################
# In your terminal navigate to key pair
# ssh -i YOUR_KEYPAIR.pem ubuntu@PUBLIC_DNS
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# https://gist.github.com/brandonb927/3195465
# To Run
# make file executable: chmod 755 <file.sh>
# sudo ./file.sh
require 'dotenv'
require 'linkedin'
Dotenv.load
module Myagencysprint
class App < Padrino::Application
register Padrino::Mailer
register Padrino::Helpers
# padrino g project my_project --template https://gist.github.com/vladiim/9fc90485b509ee4ae09e
project test: :rspec, orm: :rspec, script: :jquery, renderer: :haml, stylesheet: :scss, mock: :rr, adapter: postgres
require_dependencies 'thin'
require_dependencies 'oj'
require_dependencies 'capybara', group: :test
require_dependencies 'launchy'
require_dependencies 'debugger'
{ "keys": ["alt+up"], "command": "select_lines", "args": {"forward": false} },
{ "keys": ["alt+down"], "command": "select_lines", "args": {"forward": true} },
SELECT
c.name 'Column Name',
t.Name 'Data type',
c.max_length 'Max Length',
c.precision ,
c.scale ,
c.is_nullable,
ISNULL(i.is_primary_key, 0) 'Primary Key'
FROM
sys.columns c
library(broman)
install_github()
brocolors("crayons")
# http://www.r-bloggers.com/evaluating-model-performance-a-practical-example-of-the-effects-of-overfitting-and-data-size-on-prediction
### Data and model fitting
set.seed(1111)
n <- 50
x <- sort(runif(n, -2, 2))
y <- 3*x^3 + 5*x^2 + 0.5*x + 20 # a 3 polynomial model
err <- rnorm(n, sd=3)
ye <- y + err
df <- data.frame(x, ye)
# Heres a couple of functions for calculating the confidence intervals for proportions.
# Firstly I give you the Simple Asymtotic Method:
simpasym <- function(n, p, z=1.96, cc=TRUE){
out <- list()
if(cc){
out$lb <- p - z*sqrt((p*(1-p))/n) - 0.5/n
out$ub <- p + z*sqrt((p*(1-p))/n) + 0.5/n
} else {