Skip to content

Instantly share code, notes, and snippets.

@seankross
Created May 26, 2017 18:50
Show Gist options
  • Save seankross/cecc9b6e97174fa4b95a288b3491c0c0 to your computer and use it in GitHub Desktop.
Save seankross/cecc9b6e97174fa4b95a288b3491c0c0 to your computer and use it in GitHub Desktop.
#' @importFrom shiny
#' @import miniUI
codefinch_app <- function(){
ui <- miniPage(
gadgetTitleBar("Codefinch: Tweet Your Code",
right = miniTitleBarButton("tweet_it", "Send Tweet", primary = TRUE)),
miniContentPanel(
fillCol(flex = c(5, 2),
imageOutput("code_png"),
fillRow(flex = c(2, 1),
fillCol(textAreaInput("status", label = NULL, width = "100%", height = "100%",
resize = "both"),
fillRow(textOutput("chars"),
checkboxInput("gist_url", "Include Gist URL?"))
),
selectInput("highlight", "Select Highlight", choices = c(
"default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn","haddock"
))
)
)
)
)
server <- function(input, output){
output$code_png <- renderImage({
list(src = create_image(highlight = input$highlight))
})
output$chars <- renderText({
140 - nchar(input$status)
})
}
runGadget(ui, server, viewer = paneViewer())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment