Skip to content

Instantly share code, notes, and snippets.

@seankross
Created May 26, 2017 18:57
Show Gist options
  • Save seankross/79c6106c716c2ba0abcd8fbf579bcb21 to your computer and use it in GitHub Desktop.
Save seankross/79c6106c716c2ba0abcd8fbf579bcb21 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(padding = 40,
fillRow(flex = c(2, 3),
fillCol(
textAreaInput("status", label = NULL, width = "100%", height = "100%",
resize = "both"),
textOutput("chars"),
checkboxInput("gist_url", "Include Gist URL?"),
selectInput("highlight", "Select Highlight", choices = c(
"default", "tango", "pygments", "kate", "monochrome", "espresso", "zenburn","haddock"
))
),
imageOutput("code_png", width = "100px")
)
# fillCol(flex = c(5, 2),
# imageOutput("code_png", height = "100%"),
# 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