Skip to content

Commit

Permalink
initla commit of 455 site
Browse files Browse the repository at this point in the history
  • Loading branch information
firasm committed Apr 25, 2024
1 parent b73b78a commit bbffdc0
Show file tree
Hide file tree
Showing 250 changed files with 18,612 additions and 1 deletion.
52 changes: 52 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: deploy-book

# Only run this when the master branch changes
on:
workflow_dispatch:
push:
branches:
- main

# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Install dependencies
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: cache installation
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}

- name: Install dependencies
run: |
pip install -r requirements.txt
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Push to server
- name: rsync and ssh
env:
REMOTE_HOST: ${{ secrets.FIRAS_REMOTE_HOST }}
REMOTE_USER: ${{ secrets.FIRAS_REMOTE_USER }}
REMOTE_KEY: ${{ secrets.FIRAS_SERVER_SSH_KEY }}
REMOTE_DIR: ${{ secrets.FIRAS_REMOTE_TARGET }}
LOCAL_DIR: "_build/html/"
COURSE_NAME: "cpsc455"
TERM: "2024_S"
run: |
mkdir ~/.ssh
echo "$REMOTE_KEY" > ~/.ssh/id_rsa
ssh-keyscan -H $REMOTE_HOST >> ~/.ssh/known_hosts
chmod 600 ~/.ssh/id_rsa
rsync -avzr --delete $LOCAL_DIR $REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$COURSE_NAME/$TERM
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Firas Moosvi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
# cpsc455
# CPSC 455

## Features

1. Support for executing code in a browser using [thebe](https://thebe.readthedocs.io/en/latest/) and [mybinderorg](https://mybinder.org)!

1. Structured book with markdown file stubs aligning with a course structure for a 13 week course. Fully versioned using GitHub, automatically deployed using GH Actions to either GH or your own server. Can also be extended with a testing framework for extra peace of mind.

1. [Examples of how to use IFrames](https://firasm.github.io/jupyterbook_course_template/notes/topic1.html#) to embed web content, @phet_sims, @sli.do polls, videos, and other content.

1. Powerful built-in annotation and commenting features with [hypothes.is](http://hypothes.is) and [utteranc.es](http://utteranc.es). Annotate your syllabus, course readings, and any other content.

1. Add persistent checkboxes so students can track their progress through notebooks, exercises and readings.

1. Allow students to download pages of the site in PDF, link to the source code on your repo, or open in a mybinder notebook.

1. The JupyterBook can be embedded into Canvas using the Redirect tool so students never have to leave their LMS.

1. (NEW!) Use of the new `substitution` feature of [myst-parser](https://myst-parser.readthedocs.io/en/latest/develop/_changelog.html#id1) to configure the course algorithmically from the `_config.yml` file!

## Edit the template for your course

There are a few things you need to do to adapt this template for your course.
I might miss a few things, so this list is a work in progress:

1. In the `_config.yml` file:

- [ ] Set title of the book (Physics 111)
- [ ] Update author (Firas Moosvi)
- [ ] Update logo image (images/logo.png)
- [ ] Add Google Analytics ID (Optional)
- [ ] Enable/Disable Hypothes.is (remove the line to remove the hypothes.is integration)
- [ ] Configure Utteranc.es repository (Choose one of Hypothesis or Utteranc.es)
- [ ] Adjust `extra_footer` to control License of course materials
- [ ] Set the substitution parameters under the `myst_substitutions`

1. In the `_toc.yml` file:
- [ ] Arrange the table of contents to add/remove files

1. In the `about` and `class` folders:
- [ ] Edit the .md and .ipynb files with your course content

## Attribution

- Thanks the entire [Jupyter Project](https://jupyter.org/about)
- Finally, a big thanks to the [JupyterBook community](https://github.com/executablebooks/jupyter-book/graphs/contributors) for my incessant issues, questions, and PR requests on documentation changes.
108 changes: 108 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Book settings
title: CPSC 455
author: Firas Moosvi and Ian McLean
logo: images/logo.jpg
copyright: ""
exclude_patterns: ["LICENSE.md", "README.md"]
only_build_toc_files: true

bibtex_bibfiles:
- about/citations.bib

latex:
latex_documents:
targetname: book.tex
html:
home_page_in_navbar : true
use_repository_button: true
use_issues_button: true
use_edit_page_button: true
navbar_number_sections : false
# announcement: "Use this JupyterBook as a <a href='https://github.com/firasm/jupyterbook_course_template' style='color:pink;'>template by clicking here</a>!" # The base URL where your book will be hosted. Used for creating image previews and social links. e.g.: https://mypage.com/mybook/
# google_analytics_id: UA-11111111 # add your Google Analytics Tracking Code
comments:
hypothesis: false
utterances:
repo: "UBC-CS/cpsc455"
dokieli: false
extra_footer : |
<div>
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="https://licensebuttons.net/l/by-nc-sa/3.0/88x31.png"></a>
All content on this site (unless otherwise specified) is licensed under the <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0 license</a>
</div>
# launch_buttons:
# notebook_interface : "jupyterlab"
# binderhub_url : "https://mybinder.org"
# thebe : true

repository:
url : https://github.com/UBC-CS/cpsc455
path_to_book : ""
branch : main

sphinx:
config:
html_show_copyright: false
html_extra_path: ['files']
bibtex_reference_style: author_year
myst_heading_anchors: true
myst_heading_anchors: 3
myst_enable_extensions:
- amsmath
- colon_fence
- deflist
- dollarmath
- html_image
- linkify
- replacements
- substitution

myst_substitutions:
# Instructor information
INSTRUCTOR: "Dr. Firas Moosvi (he/his/him) and Ian"
PRONOUNCE: "Fur-az Moose-vee"
OFFICE: "ICCS 253"
PHONE: "N/A"

# Course Information
COURSE_CODE: "CPSC 455"
SECTION: "901"
CREDITS: "3"
TITLE: "Applied Industry Practices"
PREREQS: "Pre-reqs: One of CPSC 310, CPEN 321."
COREQS: "N/A"
TERM: "2024 Summer Term"
ROOM: "Online"
MEETING_TIMES: "Every other Saturday starting May 11th"
# FORMAT: "Lectures, Labs, Tutorials will all be running in-person."

# Important Links
CANVAS_ID: "142514"
CANVAS_LINK: "https://canvas.ubc.ca/courses/CANVAS_ID"
ZOOM_LINK: "[Zoom](https://canvas.ubc.ca/courses/CANVAS_ID/external_tools/15408)"
ANNOUNCEMENTS_LINK: "[Canvas Announcements](https://canvas.ubc.ca/courses/CANVAS_ID/announcements)"
COURSE_LINK: "https://firas.moosvi.com/courses/cpsc455/2024S/"
FORUM_LINK: "[Ed Discussion](https://edstem.org/us/join/xyhhmY)"
TEXTBOOK: "We will not be needing a textbook for this course as you will be provided all the notes you need via the course website and linked materials."
ANON_FEEDBACK: "[feedback form](https://ubc.ca1.qualtrics.com/?course=cpsc455&term=2024_S)"
ASSOCIATE_HEAD: "Associate Head [[email protected]](mailto:[email protected])"
ANALYTICS_OPTOUT: "[complete this form](https://ubc.ca1.qualtrics.com/jfe/form/SV_0p6lP4TtNpJn410/?course=cpsc455&term=2024_S)"

# Withdrawal Dates and Exam Period
# https://vancouver.calendar.ubc.ca/dates-and-deadlines
W_DATE_1: "11:59 PDT on January 19, 2024"
W_DATE_2: "11:59 PDT on March 1, 2024"
W_DATE_3: "11:59 PDT on March 1, 2024"
EXAM_PERIOD: "Tuesday April 16th - Saturday, April 27"

# Course Policies
GRACE_PERIOD: "48 hour"

# TA Names
TA1: "Braeden Fong"
TA1pronounce: "BRAY-DIN"
TA2: "Manushree Singhania"
TA2pronounce: "MA-NU-SHREE"
TA3: "Minh Anh Nguyen"
TA3pronounce: "Ming Ang"
11 changes: 11 additions & 0 deletions _static/custom_layouts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*********************************************
* Print-specific CSS *
*********************************************/

.table td, .table th{
padding: 0.2rem
}

.row-odd p, .row-even p{
margin-bottom: 0
}
36 changes: 36 additions & 0 deletions _static/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* Responsive IFrames
Source: https: //www.w3schools.com/howto/howto_css_responsive_iframes.asp
*/

.youtube {
position: relative;
overflow: hidden;
width: 100%;
padding-top: 56.25%;
/* 16:9 Aspect Ratio (divide 9 by 16 = 0.5625) */
}

/* Then style the iframe to fit in the container div with full height and width */
.responsive-iframe {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}

/* remove space above dropdowns */

.dropdown-margin{
margin: 0;
position: relative;
}

.sticky {
position: -webkit-sticky;
/* Safari */
position: sticky;
top: 0;
}
30 changes: 30 additions & 0 deletions _static/pdf_print.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*********************************************
* Print-specific CSS *
*********************************************/

@media print {

div.topbar {
display: none;
}

.pr-md-0 {
flex: 0 0 100% !important;
max-width: 100% !important;
}

.page_break {
/*
Control where and how page-breaks happen in pdf prints
This page has a nice guide: https://tympanus.net/codrops/css_reference/break-before/
This SO link describes how to use it: https://stackoverflow.com/a/1664058
Simply add an empty div with this class where you want a page break
like so: <div class="page_break"></div>;
*/
clear: both;
page-break-after: always !important;
break-after: always !important;
}

}
13 changes: 13 additions & 0 deletions _static/plausible_cpsc455.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// NOTE: This file allows my privacy-focused analytics provider (Plausible) to
// collect data on various aspects of usage.
// Those that are using this repo as a template should REMOVE this file from their repo

var script = document.createElement("script");
script.defer = true;
script.src = "https://plausible.io/js/script.js";
script.dataset.domain = "cpsc455";

// optional if using proxy
// script.dataset.api = 'https://yourproxy.com/api/event';

document.getElementsByTagName("head")[0].appendChild(script);
32 changes: 32 additions & 0 deletions _static/save_state.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

/* This code is copied verbatim from this SO post by Rory McCrossan: https://stackoverflow.com/a/51543474/2217577.
The code was shared under the CC BY-SA 4.0 license: https://creativecommons.org/licenses/by-sa/4.0/
It's purpose is to simply store the state of checked boxes locally as a localStorage object.
To use it, simply add checkboxes as normal within your md files:
<input type="checkbox" id="box-1" class="box"> Item 1 </input>
<input type="checkbox" id="box-2" class="box"> Item 2 </input>
<input type="checkbox" id="box-3" class="box"> Item 3 </input>
*/

function onClickBox() {
var arr = $('.box').map(function() {
return this.checked;
}).get();
localStorage.setItem("checked", JSON.stringify(arr));
}

$(document).ready(function() {
var arr = JSON.parse(localStorage.getItem('checked')) || [];
arr.forEach(function(checked, i) {
$('.box').eq(i).prop('checked', checked);
});

$(".box").click(onClickBox);
});


Loading

0 comments on commit bbffdc0

Please sign in to comment.