This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(dplyr) | |
library(lubridate) | |
# Load libraries and functions needed to create SQLite databases. | |
library(RSQLite) | |
library(RSQLite.extfuns) | |
saveSQLite <- function(data, name){ | |
path <- dplyr:::db_location(filename=paste0(name, ".sqlite")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\begin{document} | |
<<names>>= | |
input$firstname | |
input$lastname | |
@ | |
\end{document} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
rawDataUrl <- "http://pub.data.gov.bc.ca/datasets/176284/BC_Liquor_Store_Product_Price_List.csv" | |
bcl <- read.csv(rawDataUrl, stringsAsFactors = FALSE) | |
products <- c("BEER", "REFRESHMENT BEVERAGE", "SPIRITS", "WINE") | |
bcl <- dplyr::filter(bcl, PRODUCT_CLASS_NAME %in% products) %>% | |
dplyr::select(-PRODUCT_TYPE_NAME, -PRODUCT_SKU_NO, -PRODUCT_BASE_UPC_NO, | |
-PRODUCT_LITRES_PER_CONTAINER, -PRD_CONTAINER_PER_SELL_UNIT, | |
-PRODUCT_SUB_CLASS_NAME) %>% | |
rename(Type = PRODUCT_CLASS_NAME, | |
Subtype = PRODUCT_MINOR_CLASS_NAME, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(rmarkdown) | |
shinyServer(function(input, output) { | |
output$html = reactive({ | |
t <- tempfile() | |
cat(input$markdown, file = t) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_ALL | ~E_NOTICE); | |
// Config | |
$url = "https://bitbucket.org/USERNAME/PROJECT/get/master.zip"; | |
$user = "USERNAME"; | |
$pass = "PASSWORD"; | |
$tempfile = "thinkbox-ci.zip"; | |
$target = "./"; | |
$access_key = "ACCESS_KEY"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example Dockerfile | |
FROM hello-world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Generates a pre-signed S3 URL using a valid key pair that lasts for 20 years. | |
Reference: http://forrst.com/posts/Python_method_for_creating_authenticated_s3_URLs-uUM | |
""" | |
import base64, hmac, os, sha, sys, time, urllib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import boto, argparse | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-b','--bucket', help='Name of your S3 Bucket', required=True) | |
parser.add_argument('-o','--object', help='Name of the object + prefix in your bucket', required=True) | |
parser.add_argument('-t','--time', type=int, help='Expirery in seconds Default = 60', default=60) | |
args = vars(parser.parse_args()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext.wtf import Form | |
from flask.ext.babel import gettext | |
from wtforms import SelectField, TelField, TextField, FormField, Fieldlist, SubmitField | |
from wtforms.validators import Optional, Required | |
app = Flask(__name__) | |
db = SQLAlchemy(app) |