Skip to content

Instantly share code, notes, and snippets.

Avatar
🦑
Tappity tap tap

Mark MarkEdmondson1234

🦑
Tappity tap tap
View GitHub Profile
@MarkEdmondson1234
MarkEdmondson1234 / send_email_mailgun.R
Last active Apr 22, 2021
Send an email via an R function using Mailgun
View send_email_mailgun.R
#' Email a user a report is ready
#'
#' Requires an account at Mailgun: https://mailgun.com
#' Pre-verification can only send to a whitelist of emails you configure
#'
#' @param email Email to send to
#' @param mail_message Any extra info
#'
#' @return TRUE if successful email sent
#' @import httr
@MarkEdmondson1234
MarkEdmondson1234 / fb-ios14-email.md
Last active Apr 22, 2021
Facebook Marketing Partners Team response for Apple's iOS14 Privacy prompt
View fb-ios14-email.md

Hi Mark,

Yesterday (April 20, 2021), Apple confirmed it will make iOS 14.5 available to all iOS users next week, and it will start requiring apps in the App Store to obtain permission through its AppTrackingTransparency framework to “track” users across apps and websites owned by third parties for advertising and measurement purposes.

With the general availability of iOS 14.5 (week of April 26), we will begin rollout of our new advertiser experiences and measurement protocols – including Apple’s SKAdNetwork API (SKAN) and Facebook’s Aggregated Event Measurement (AEM). Once the specific date of the general availability release of 14.5 is confirmed, we will establish the rollout timing of our new experiences and communicate this timing.

You and your clients can expect to see changes in our business and advertising tools, campaign set up, targeting, delivery, measurement, and reporting, following the release of iOS 14.5 and Apple’s prompt enforcement. We are sharing a summary of these changes below, as well a

@MarkEdmondson1234
MarkEdmondson1234 / app.R
Last active Jan 25, 2021 — forked from jcheng5/app.R
Using OAuth2 with Shiny
View app.R
library(shiny)
# WARNING: This sketch does not make proper use of the "state" parameter.
# Doing so usually involves using cookies, which can be done with the
# Rook package but I have not done that here. If you choose to use this
# approach in production, please check the state parameter properly!
APP_URL <- if (interactive()) {
# This might be useful for local development. If not, just hardcode APP_URL
# to the deployed URL that you'll provide a few lines below.
@MarkEdmondson1234
MarkEdmondson1234 / dynamicSelectShinyModule.R
Last active Nov 21, 2020
Shiny modules for creating dynamic SelectInputs
View dynamicSelectShinyModule.R
library(shiny)
#' Safe subset
#'
#' @param df Dataframe
#' @param column One name of column to subset within
#' @param subset Vector of entries in column to subset to
#'
#' If column not in df, returns back the df
safeSubset <- function(df, column, subset){
@MarkEdmondson1234
MarkEdmondson1234 / server.r
Created Feb 16, 2014
Cascading Menu System for Shiny
View server.r
library(shiny)
## test dataframe
df <- data.frame(option1 = c("A","A","B","B","C","C"),
option2 = c("A1","A2","B3","B1","C2","C3"),
option3 = c(T,F,T,F,T,F),
option4 = c("a","b","c","d","e","f"))
shinyServer(function(input, output, session) {
@MarkEdmondson1234
MarkEdmondson1234 / snippet_modules.R
Last active Jul 17, 2020
RStudio snippet to make a shortcut for Shiny Module scaffolding
View snippet_modules.R
snippet module
#' ${1:module_name} UI
#'
#' Shiny Module for use with \link{${1:module_name}}
#'
#' @param id Shiny id
#'
#' @return Shiny UI
${1:module_name}UI <- function(id){
View debug_dynamic_select.R
library(shiny)
dynamicSelectInput <- function(id, label, multiple = FALSE){
ns <- shiny::NS(id)
shiny::selectInput(ns("dynamic_select"), label,
choices = NULL, multiple = multiple, width = "100%")
}
@MarkEdmondson1234
MarkEdmondson1234 / auth.r
Last active Feb 24, 2020
Authenticate a Twitter app in R
View auth.r
# Refer to https://rtweet.info/
@MarkEdmondson1234
MarkEdmondson1234 / gist:db2f4946fa11eea2a3f8
Last active Feb 21, 2020
Google Trend Download example
View gist:db2f4946fa11eea2a3f8
## uncomment this and install from github if you don't have it already
# library(devtools)
# devtools::install_github("dvanclev/GTrendsR")
## load library
library(GTrendsR)
## create a connection with your gooooogle account details.
ch <- gconnect('your google email', 'your google pw')
@MarkEdmondson1234
MarkEdmondson1234 / HWplot.R
Created Jun 18, 2014
A function to plot a holtWinters timeseries in ggplot2
View HWplot.R
#HWplot.R
library(ggplot2)
library(reshape)
HWplot<-function(ts_object, n.ahead=4, CI=.95, error.ribbon='green', line.size=1){
hw_object<-HoltWinters(ts_object)