Skip to content

Instantly share code, notes, and snippets.

View nfultz's full-sized avatar
🌯

Neal Fultz nfultz

🌯
View GitHub Profile
@nfultz
nfultz / app.R
Last active November 8, 2017 21:39 — forked from mine-cetinkaya-rundel/app.R
Shiny dynamic UI - observers & for loop
# An example based on http://shiny.rstudio.com/articles/dynamic-ui.html
library(shiny)
ui = basicPage(
fluidRow(
actionButton(inputId = "add_buttons", label = "Add 5 Buttons")
),
uiOutput("more_buttons") # this is where the dynamically added buttons will go
)
If you have a huge repository (in size and in history) and want to add a subfolder
to your project as a submodule you can follow this example to save time and space
using git's shallow clone and shallow checkout feature. It is a bit more complicated
in this example because I assume that you want your submodule to track a non-default
branch, called `mybranch`, instead of the `master` branch. Things could probably get
a lot simpler when using the default branch. After following the commands in these
examples you can use `git submodule update` and `git submodule update --remote` as normal.
@nfultz
nfultz / quadprog_ipoptr_translate.R
Created September 19, 2016 15:39 — forked from rwalk/quadprog_ipoptr_translate.R
Quadratic programming: Use matrix inputs to solve a QP with ipoptr
ipoptr_qp <- function(Dmat, dvec, Amat, bvec, ub=100){
# Solve the quadratic program
#
# min -d^T x + 1/2 x^T D x
# s.t. A%*%x>= b
#
# with ipoptr.
n <- length(bvec)
# Jacobian structural components