Skip to content

Instantly share code, notes, and snippets.

View bborgesr's full-sized avatar

Barbara Borges Ribeiro bborgesr

View GitHub Profile
@bborgesr
bborgesr / pseudo-navigation-shiny.R
Created June 30, 2017 20:43
Implements pseudo navigation in a Shiny app
library(shiny)
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
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")
),
mainPanel(
@bborgesr
bborgesr / shiny-reactive-R6-object.R
Created August 1, 2017 21:22
Uses the reactiveTrigger() construct in an R6 object class in order to make it useful in reactive settings, like a Shiny app (MWE included)
library(shiny)
reactiveTrigger <- function() {
counter <- reactiveVal( 0)
list(
depend = function() {
counter()
invisible()
},
trigger = function() {
@bborgesr
bborgesr / shiny-insertUI-removable.R
Last active June 7, 2023 12:07
Uses Shiny's insertUI to create elements (in this example, datatables) at the user's discretion; each of these comes with a button that will remove it from the app (using removeUI).
library(shiny)
ui <- fluidPage(
textInput("divID", "Enter an ID for the custom area:", ""),
helpText("Leave the text input blank for automatically unique IDs."),
actionButton("isrt", "Add a datatable"),
tags$div(id = "placeholder")
)
server <- function(input, output, session) {
rv <- reactiveValues()
@bborgesr
bborgesr / exceptionally-good-presentations.txt
Created February 8, 2018 00:44 — forked from jmcphers/exceptionally-good-presentations.txt
How to Give an Exceptionally Good Presentation
"HOW TO GIVE AN EXCEPTIONALLY GOOD PRESENTATION"
CHARACTERS
Joe Cheng.............Moderator
Jennifer Bryan........As Herself
Hadley Wickham........As Himself
Aron Atkins...........Audience
Derrick Kearney.......Audience
@bborgesr
bborgesr / cards-crud-inside-map-inside-buildCards.js
Last active March 14, 2019 15:35
[Make a CMS card's id unique] Reusing existing code, and keeping in mind that it's preferrable to destructure the object rather than mutate the id in place. #cms
try {
const card = buildCard(
card,
data,
filtersAndFormatters,
Object.assign({}, settingsAndOptions, { cardIndex })
);
return {...card, id: `${card.id}:${cardIndex}`};
}
@bborgesr
bborgesr / to-do-list-vanilla-js.html
Created December 19, 2019 14:00
A very simple ToDo app using only vanilla JS
<html>
<head>
<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="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
@bborgesr
bborgesr / simple-server.js
Created February 4, 2020 09:26
A simple server to serve mock data for the Room Manager app (https://github.com/bborgesr/room-manager)
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
bborgesr / grokking_to_leetcode.md
Created May 14, 2022 05:12 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

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