Skip to content

Instantly share code, notes, and snippets.

View briandk's full-sized avatar

Brian A. Danielak briandk

View GitHub Profile
@briandk
briandk / gt-quarto-split-table-bug.qmd
Last active October 2, 2023 15:12
Trying to create a reproducible example of a bug in the `gt` package for R.
---
title: "GT Quarto Split Table Bug Test"
format:
docx: default # renders fine
html: default # fails with error (see below)
pdf: default # fails with error (see below)
---
## Test Code
@briandk
briandk / elm-json-decode-pipeline.md
Created November 25, 2022 20:21
Trying to understand why the order of `required` statements matters in an Elm JSON Decode Pipeline

Why does the order of required statements matter in a JSON Decode Pipeline?

Background

I’m currently working through the book Programming Elm by Jeremy Fairbank. I’m on Chapter 4, where he introduces JSON decoders and the Json.Decode.Pipeline package. Please bear with me, as I’m an Elm beginner. I’m also working in the Elm repl, as I’m not currently sure how to translate my work into a full Elm program.

What I Expect to Happen

In Elm, the order of requireds in a JSON decode pipeline shouldn’t matter for successful decoding, because we’re matching the names of the keys in the JSON oject to the names of the fields in a record. There is no inherent order to the fields of an Elm record, just as there is no inherent order to the properties of a JSON object.

@briandk
briandk / rstudioconf2022-presentation-links.md
Last active July 27, 2022 15:57
List of links related to my rstudio::conf 2022 presentation on designing a socially critical data science course
@briandk
briandk / siuba-datetime-example.py
Last active July 31, 2022 20:35
- Applying `pd.to_datetime()` to a column using `mutate` seems to fail
import pandas as pd
from siuba import *
my_data = {
'name': ["Abigail Adams"],
'birth': ["1744-11-22"],
'death': ["1818-10-28"]
}
df = pd.DataFrame(my_data)
@briandk
briandk / learning-objectives.md
Created May 19, 2022 02:02
The original lest of modeling objectives from MSU’s CMSE 201 - Introduction to Computational Modeling

Course Learning Objectives

Modeling begins before you ever touch a computer

  • How do I understand the system of interest?
  • Within that system, what phenomena am I interested in?
  • What entities do I think are relevant for my model?
  • How might I qualitatively describe entity relationships in the model? (Example: predators hunt prey, so predators should have some contribution to the reduction of prey.)
  • What simplifications do I know I’m making?
  • How can I express expectations of/predictions about the model? (E.g., with one wolf and 10 million rabbits, I don’t think there will be much of a predator effect. Or: here’s a sketch of the path I think this orbiting body might take. Or: based on my experiences with kerbal space program, I figure the object would take a path like this.)
@briandk
briandk / programming-primer.md
Created March 5, 2021 20:03
A programming primer

If you can read this, thank a teacher.

if (you_can_read_this) {
  thank(a_teacher)
}
@briandk
briandk / classroom-norms-1907-gh-ny-web-ft.md
Last active February 22, 2021 13:43
Classroom Norms for 1907-GHP-NY-WEB-FT
  • Be Present
  • Be Kind
  • Take Space and Make Space (be mindful of how much time/space you're taking up and be willing to yield to others)
  • For morning review, put your questions up the night before
  • Listen without interrupting
  • It's ok to talk about friction we might have working with each other
  • Confirming that we understand each other by rephrasing. ("What I'm hearing is...")
  • No Question Is a Ridiculous Question
  • Every mistake can teach you something. Treat mistakes as growth and learning opportunities.
  • This is also true of unintenionally harmful communication
@briandk
briandk / fun-with-javascript.js
Created June 28, 2019 16:06
What do you predict these expressions will return? Fun with undefined and Object.keys
Object.keys(undefined)
undefined + {}
Object.keys(undefined + {})
(undefined + {})[Object.keys(undefined + {})[23]]
@briandk
briandk / engineering-ethics-and-workplace-norms.md
Created June 13, 2019 21:18
Engineering ethics and workplace norms elective - 1902 fsa GH NY

Engineering Ethics and Workplace Norms(?)

What do you hope to get out of this?

  • Hear Brian call 1902GH his favorite cohort
  • What are bad ethics? Why do we we even need to know engineering ethics?
  • How Facebook got to where it was?
    • How do we prevent those kinds of things from happening?
    • How do we see it in a work?
    • What is our role as engineers in a company when it comes to that?
@briandk
briandk / editingJLists.java
Last active March 5, 2019 01:48
Editing a JList in Java. This code repeatedly adds the user “Krang” to a list every time the button is pressed.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
DefaultList newList = new DefaultListModel();
ListModel oldList = (ListModel) myList.getModel();
// Copy over the old list
for (int i = 0; i < oldList.getSize(); i++) {;
newList.add(i, oldList.getElementAt(i));
}
newList.add(0, "Krang");