Skip to content

Instantly share code, notes, and snippets.


Barbara Borges Ribeiro bborgesr

View GitHub Profile
bborgesr / reactives-in-loops.R
Created Mar 5, 2017
How to use reactives in loops. What works, what doesn't and why.
View reactives-in-loops.R
# -------------------------------------------------------------------
# ------------------ REACTIVES INSIDE FOR LOOPS ---------------------
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# --- EXAMPLE 1: this works fine, because there are no reactives in -
# --- the for lopp --------------------------------------------------
# -------------------------------------------------------------------
bborgesr / shiny-reactive-R6-object.R
Created Aug 1, 2017
Uses the reactiveTrigger() construct in an R6 object class in order to make it useful in reactive settings, like a Shiny app (MWE included)
View shiny-reactive-R6-object.R
reactiveTrigger <- function() {
counter <- reactiveVal( 0)
depend = function() {
trigger = function() {
bborgesr /
Created May 14, 2022 — forked from tykurtz/
Grokking the coding interview equivalent leetcode problems


I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

bborgesr / dynamic-dropdownMenu.R
Created May 9, 2017
How to dynamically add items to a dropdownMenu in shinydashboard
View dynamic-dropdownMenu.R
ui <- dashboardPage(
dashboardHeader(title = "Dropdowns 2.0",
helpText("Add another item to the dropdown menu by clicking ",
"on the button below"),
bborgesr / reset-fileInput-and-data.R
Created Mar 20, 2017
How to "reset" a fileInput widget and the underlying data (must treat these as two different things)
View reset-fileInput-and-data.R
ui <- fluidPage(
fileInput('inFile', 'Choose file'),
actionButton('reset', 'Reset'),
bborgesr / pseudo-navigation-shiny.R
Created Jun 30, 2017
Implements pseudo navigation in a Shiny app
View pseudo-navigation-shiny.R
ui <- fluidPage(
tags$a("Go to Panel 1", href = "#panel1"), br(),
tags$a("Go to Panel 2", href = "#panel2"), br(),
tags$a("Go to Panel 3", href = "#panel3")
bborgesr / modular-processing.R
Created Mar 8, 2017
Processing input data, step by step, using Shiny modules
View modular-processing.R
# -------------------------------------------------------------------
# ------------------ PROCESSING DATA MODULARLY----------------------
# -------------------------------------------------------------------
# This app processes some input text through three modules, passing
# the result of each module down to the next module. We're also
# displaying to the user the (reactive) result of each module, but
# usually we'd just be interested in the last one... In those cases,
# the modules' ui functions would be empty (except for the last
# module, of course).
bborgesr / simple-server.js
Created Feb 4, 2020
A simple server to serve mock data for the Room Manager app (
View simple-server.js
const express = require("express");
const cors = require("cors");
const reservations = [
reservaID: 1,
usuarioID: 1,
salaID: 1,
data: "2020-01-31",
horaEntrada: "2020-01-31T10:00:00",
bborgesr / to-do-list-vanilla-js.html
Created Dec 19, 2019
A very simple ToDo app using only vanilla JS
View to-do-list-vanilla-js.html
<title>Wonderful Task Manager</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
bborgesr / hide-datatable-shiny.R
Created Mar 7, 2017
How to make a DataTable actually become hidden in a Shiny app
View hide-datatable-shiny.R
# -------------------------------------------------------------------
# ------------------ HIDIND A DATATABLE IN SHINY --------------------
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# --- EXAMPLE 1: this sets the datatable's underlying dataframe to --
# --- NULL, inside a reactive (recalculated whenever a checkbox is --
# --- clicked). While this does result in the datatable disappearing
# --- from view, the height does not show ---------------------------