Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
“andytai7” committed Sep 16, 2024
2 parents 9e7dcce + 0c38f58 commit c170966
Show file tree
Hide file tree
Showing 23 changed files with 1,736 additions and 622 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
**.DS_Store

# temp jupyter notebook used for quarto jupyter execution
.quarto_ipynb
**.quarto_ipynb

/.quarto/
_site/
Expand Down
4 changes: 4 additions & 0 deletions DESCRIPTION_temp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# notes for package we installed

- RMarkdown
- here
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ render:

setup_python_venv:
pip freeze | xargs pip uninstall -y
pip install --upgrade pip
pip install -r requirements.txt
pip freeze > requirements_snapshot.txt

Expand Down
83 changes: 63 additions & 20 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
project:
type: website
preview:
port: 54321
browser: true

website:
title: "DSCI 521: Computing Platforms for Data Science"
site-url: https://ubc-mds.github.io/DSCI_521_platforms-dsci_book/
issue-url: https://github.com/UBC-MDS/DSCI_521_platforms-dsci_book/issues/new
repo-actions: [edit, source, issue]
google-analytics: "G-1RNLL8GPXK"
open-graph: true
twitter-card: true
page-navigation: true
bread-crumbs: true
search:
show-item-context: true
type: overlay
navbar:
right:
- icon: github
href: https://github.com/UBC-MDS/DSCI_521_platforms-dsci_book
aria-label: GitHub
left:
- href: index.qmd
text: Home
Expand All @@ -16,27 +34,52 @@ website:
style: "docked"
search: true
contents:
- text: "Lecture 0a: JupyterLab Orientation"
href: lectures/0-jupyterlab-orientation-intro.qmd
- text: "Lecture 0b: RStudio Orientation"
href: lectures/0-rstudio-orientation-intro.qmd
- text: "Lecture 1: Introduction to MDS software and Bash"
href: lectures/1-MDStools-bash-filesystem.qmd
- text: "Lecture 2: Introduction to version control with Git and GitHub"
href: lectures/2-git-github-ssh-basic-workflow.qmd
- text: "Lecture 3: Getting grovy with Git and GitHub"
href: lectures/3-git-history-merge-conflicts-stash.qmd
- text: "Lecture 4: Introduction to Quarto and Github Pages"
href: lectures/4-quarto_github_pages.qmd
- text: "Lecture 5: Dynamic documents: from markdown to Rmarkdown documents"
href: lectures/5-rstudio-projects-notebooks.qmd
- text: "Lecture 6: Quarto, RMarkdown, and Jupyter Slides"
href: lectures/6-rmarkdown-quarto-slides-ghpages.qmd
- text: "Lecture 7: Virtual environments"
href: lectures/7-virtual-environments.qmd
- text: "Lecture 8: Organization of Data Science projects and some useful tools"
href: lectures/8-regex-filenames-project-organization.qmd

- section: "Orientation"
contents:
- text: "Lecture 0a: JupyterLab Orientation"
href: lectures/0-jupyterlab-orientation-intro.qmd
- text: "Lecture 0b: RStudio Orientation"
href: lectures/0-rstudio-orientation-intro.qmd

- section: "Lectures"
contents:
- text: "Lecture 1: Introduction to MDS software and Bash"
href: lectures/1-MDStools-bash-filesystem.qmd

- text: "Lecture 2: Introduction to version control with Git and GitHub"
href: lectures/2-git-github-ssh-basic-workflow.qmd

- text: "Lecture 3: Git: History, Conflicts, and Ignores"
href: lectures/3-git-history-merge-conflicts-stash.qmd

- text: "Lecture 4: Introduction to Quarto and Github Pages"
href: lectures/4-quarto_github_pages.qmd

- text: "Lecture 5: RStudio Projects and Literate Programming Documents"
href: lectures/5-rstudio-projects-notebooks.qmd

- text: "Lecture 6: Quarto, RMarkdown, and Jupyter Slides"
href: lectures/6-rmarkdown-quarto-slides-ghpages.qmd

- text: "Lecture 7a: Virtual environments: conda"
href: lectures/7a-virtual-environments-conda.qmd
- text: "Lecture 7b: Virtual environments: renv"
href: lectures/7b-virtual-environments-renv.qmd

- text: "Lecture 8a: Organization of Data Science projects"
href: lectures/8-regex-filenames-project-organization.qmd
- text: "Lecture 8b: Introduction to Regular Expressions (RegEx)"
href: lectures/8b-regex.qmd

- section: "Appendix"
contents:
- text: "Git Configuration"
href: appendix/git_config.qmd
- text: "RStudio Configuration"
href: appendix/rstudio_config.qmd
- text: "Semantic Line Breaks"
href: appendix/semantic_line_breaks.qmd

format:
html:
Expand Down
90 changes: 90 additions & 0 deletions appendix/git_config.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
title: "Git Configuration"
---

A short list of commands for git setup from the installation instructions
and other settings to get goit working from the course

Configure your git commit messages (User and Email)

Use your email for github.com (not ubc github)

```
git config --global user.name ""
git config --global user.email ""
```

SSH keys

```
sudo systemctl enable teamviewerd
```

Edit `~/.ssh/config`

::: {.panel-tabset}

## MacOS + *nix

```
Host github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
Host github.ubc.ca
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
```


## Git Bash (Windows)

```
Host github.com
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
Host github.ubc.ca
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
```
:::


Use your `~/.ssh/id_ed25519.pub` file and copy paste the contents to register your SSH key
in **BOTH** the `github.com` and `github.ubc.ca` repositories

## Git pull merge option

If you push and try to pull with changes in the repote,
you need to tell git how to reconsize the differences

You may see this

```
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint: git config pull.rebase false # merge
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
```

We will use the old git default setting of `rebase false` (the first option).

You can do this as a repo specific setting or as a global setting (add a `--global` flag)
like you did with `user.name` and `user.email`

- Repo setting: `git config pull.rebase false`
- Global: `git config --global pull.rebase false`

THen you can `pull` again, where you may or may not see a merge conflict.
39 changes: 39 additions & 0 deletions appendix/rstudio_config.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: "RStudio Configuration"
---

## Global Setup

In the `Tools` > `Global Options` > `General` Tab,
you want to uncheck the boxes that open previous files and projects,
and also make sure that no `.RData` is saved when you quit RStudio,
and to never save the `.RData`
(this prevents RStudio from loading up previous data when you open it,
it does not refer to its ability to load and save data as you use it).

![](../lectures/img/rstudio-global_options-general.png)

## LaTeX and XeLaTeX

In the `Sweave` option

change the `Sweave` option to `Knitr`,
and `pdflatex` to `xelatex`.




## Code snippets

As we started to type `for` above,
the code completion popped up
and the first entry said "snippet",
what is that?
A code snippet is a text macro,
which means that you can type a short string of characters
to insert a template or snippet of text by pressing <kbd>TAB</kbd>.
You can see all the default snippets
and define your own by going to
`Tools -> Global options -> Code -> Edit snippets`.
Snippets are available anywhere in RStudio,
not just in R Markdown documents.
75 changes: 75 additions & 0 deletions appendix/semantic_line_breaks.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: "Semantic Line Breaks"
---

> Most documents go through several versions (always more than you expected) before they are finally finished. Accordingly, you should do whatever possible to make the job of changing them easy.
>
> First, when you do the purely mechanical operations of typing, type so subsequent editing will be easy. Start each sentence on a new line. Make lines short, and break lines at natural places, such as after commas and semicolons, rather than randomly. Since most people change documents by rewriting phrases and adding, deleting and rearranging sentences, these precautions simplify any editing you have to do later.
>
> — Brian W. Kernighan, 1974 [9]

Semantic line breaks utilize how markdown treats line breaks and tries to combine it
with regular prose text.
You can read more about semantic line breaks here: <https://sembr.org/>

Here are examples of how it works with markdown syntax


```markdown
this is a very long line that has over 80 characterslasdfja asldfja sljf lsd jflkadjsf
```

is rendered as:

this is a very long line that has over 80 characterslasdfja asldfja sljf lsd jflkadjsf


```markdown
this is a very long line that has
over 80 characterslasdfja asldfja
sljf lsd jflkadjsf
```

is rendered as:

this is a very long line that has
over 80 characterslasdfja asldfja
sljf lsd jflkadjsf


### Add a line break

Markdown allows 2 spaces at the end of a line for a line break

```markdown
this is a very long line that has<br/>
over 80 characterslasdfja asldfja<br/>
sljf lsd jflkadjsf
```

this is a very long line that has<br/>
over 80 characterslasdfja asldfja<br/>
sljf lsd jflkadjsf

Markdown also allows 2 spaces at the end of a line for a line break.
THis may not work with many text editor options that strip trailing white space


### Add an empty line for a paragraph break

```markdown
this is a very long line that has

over 80 characterslasdfja asldfja

sljf lsd jflkadjsf
```

Rendered as:

this is a very long line that has

over 80 characterslasdfja asldfja

sljf lsd jflkadjsf
14 changes: 7 additions & 7 deletions learning_objectives/lo-ch-05.qmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
1. Create RProjects in Rstudio using `here` to define robust file paths.
2. Detect the basic components of a dynamic document in Jupyter Notebooks and in R Markdown
3. Explain markdown usage in relation to dynamic documents
4. Differentiate between code chunks and code cells in Rmarkdown and Jupyter Notebooks.
5. Select appropiate code chunk options for RMarkdown.
6. Use semantic line breaks for version control files
7. Specify metadata in the YAML header block
1. Create RProjects in RStudio using `here` to define robust file paths.
2. Detect the basic components of a dynamic document in Jupyter Notebooks and in R Markdown.
3. Explain markdown usage in relation to dynamic documents.
4. Differentiate between code chunks and code cells in RMarkdown and Jupyter Notebooks.
5. Select appropriate code chunk options for RMarkdown.
6. Use semantic line breaks for version control files.
7. Specify metadata in the YAML header block.
2 changes: 1 addition & 1 deletion learning_objectives/lo-ch-06.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1. Understand how Quarto extend RMarkdown documents functionalities.
1. Understand how Quarto extend R Markdown documents functionalities.
2. Explore different data science products to communicate your results: slides, blogs and books.
3. Create slides using Jupyter Notebook and Quarto slides with `reveal.js`
4. Create a Jupyter Book and a Quarto books.
Expand Down
2 changes: 2 additions & 0 deletions lectures/0-jupyterlab-orientation-intro.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jupyter: python3

{{< include ../learning_objectives/lo-ch-00.qmd >}}

**Platform in focus** Jupyter Lab

## What is JupyterLab

The most rudimentary interaction with programming languages
Expand Down
4 changes: 3 additions & 1 deletion lectures/0-rstudio-orientation-intro.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ title: "RStudio Orientation"

{{< include ../learning_objectives/lo-ch-00-rstudio.qmd >}}

**Platform in focus** RStudio IDE

## What is RStudio

RStudio is another integrated development environment (IDE),
Expand Down Expand Up @@ -38,7 +40,7 @@ you can run RStudio as a desktop application.

## RStudio Panes

RStudio follows a "four-pane datascience" IDE view:
RStudio follows a "four-pane data science" IDE view:

1. Editor: Where you will type your code and work with other source documents
2. Environment: Contains the variables in your current session
Expand Down
4 changes: 3 additions & 1 deletion lectures/1-MDStools-bash-filesystem.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jupyter: python3

{{< include ../learning_objectives/lo-ch-01.qmd >}}

**Platform in focus** BASH

## Introduction

Welcome to Computer Platforms in Data Science!
Expand Down Expand Up @@ -360,7 +362,7 @@ Which command would move you to the parent directory?

```
A. cd .
B. cd ..
B. cd ..
C. cd ~
D. cd
```
Expand Down
Loading

0 comments on commit c170966

Please sign in to comment.