Skip to content

Instantly share code, notes, and snippets.

View vfulco's full-sized avatar

Vincent C Fulco vfulco

  • Weisisheng Corporate Management Consulting (Shanghai) Ltd.
  • Shanghai, China
View GitHub Profile
@johnmyleswhite
johnmyleswhite / costly_bigints.jl
Last active December 18, 2015 11:09
Int's vs. BigInt's
function foo(n::Integer)
x::Int = 0
t1::Float64 = @elapsed for i in 1:n
x = x + 1
end
@printf "Int: %f\n" t1
y::BigInt = BigInt(0)
t2::Float64 = @elapsed for i in 1:n
y = y + BigInt(1)
@rpietro
rpietro / perc.r
Created July 8, 2013 22:34
Rmarkdown chunk to calculate percentage. simple but very useful when putting multimarkdown tables inside Rmarkdown
```{r echo=FALSE, error=TRUE}
perc <- function(var){
result <- 100*(table(var))/sum(table(var))
return(result)
}
```
@yihui
yihui / input.Rnw
Last active June 13, 2021 17:45
use knitr (knit2pdf) to generate a PDF report in a Shiny app
\documentclass{article}
\begin{document}
<<names>>=
input$firstname
input$lastname
@
\end{document}
@cjbayesian
cjbayesian / AUC.R
Last active January 7, 2017 04:50
Calculate and plot AUC
###################################################
##
## Functions for calculating AUC and plotting ROC
## Corey Chivers, 2013
## [email protected]
##
###################################################
## Descrete integration for AUC calc
@mbusigin
mbusigin / llxc.R
Created December 10, 2013 02:53
Lead/Lag Cross Correlation between XTS objects
llxc = function( a, ll=-12:12, legend.loc="topleft", displayLegend=T, legend.cex=1.0, overplot=F )
{
if ( ncol(a) < 2 )
{
print( "Not enough columns")
return;
}
a = na.omit(a)
@bearloga
bearloga / tabletools.R
Created January 9, 2014 00:40
This shows how to add a DataTables plug-in (in this case TableTools) to your Shiny app.
library(shiny)
library(ggplot2)
# Download DataTables JS file and TableTools full package from http://datatables.net/download/
# Change the paths appropriately:
addResourcePath('datatables','/Users/yourusername/Downloads/DataTables-1.9.4/media')
addResourcePath('tabletools','/Users/yourusername/Downloads/TableTools-2.1.5/media')
runApp(list(
ui = basicPage(
@jgm
jgm / letter.latex
Created January 12, 2014 18:06
pandoc letter template
\documentclass[letter,$if(fontsize)$$fontsize$,$else$10pt,$endif$$if(lang)$$lang$,$endif$$if(papersize)$$papersize$,$endif$]{ucbletter}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage{amssymb,amsmath}
\linespread{$if(linespread)$$linespread$$else$1.1$endif$}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
@vfulco
vfulco / AUC.R
Created January 24, 2014 14:25 — forked from cjbayesian/AUC.R
###################################################
##
## Functions for calculating AUC and plotting ROC
## Corey Chivers, 2013
## [email protected]
##
###################################################
## Descrete integration for AUC calc
@ramnathv
ramnathv / README.md
Created January 30, 2014 00:33
Creating PDF Version of Slidify Presentations

This gist consists of a makefile and a script that can automate the creation of PDFs from Slidify generated HTML slides. The script assumes that the makefile and the script makepdf.js are in the same directory as the Rmd file. The makepdf.js script uses casperjs, a very useful utility to automate tasks that require browser interaction. You may follow the installation instructions on the casperjs website, to make sure that you have all the dependencies correctly installed before trying this out.

@milktrader
milktrader / doji.jl
Created February 9, 2014 14:17
what days were doji days in SPX from 1950 - 2013
julia> using TimeSeries, MarketTechnicals, MarketData, Lazy
julia> @> OHLC doji findall x->OHLC[x] x->x.timestamp
166-element Array{Date{ISOCalendar},1}:
1962-03-02
1962-04-13
1962-07-16
1962-10-08
1963-02-08
1963-05-22