This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implementer writes this class. | |
// We haven't written "implements List<E>" (later we might write in the AbstractList) | |
public class LinkedList<E> { | |
// Both front and back are class invariants! | |
// The implementer must always ensure between method calls that | |
// front points to the first node | |
// and back points the last node! | |
// Reference to the first node in the sequence. | |
private Node front; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There are a lot of methods needed to implement List! | |
// Abstract classes like AbstractList make this easier! | |
import java.util.AbstractList; | |
// Implementer writes this class. | |
public class ArrayList<E> extends AbstractList<E> { | |
private E[] elementData; | |
private int size; | |
public ArrayList() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code is written by the implementer. | |
// In addition to the compareTo function, we also write "implements Comparable<...>" to | |
// indicate to Java that this class satisfies the contract for Comparable. | |
public class Account implements Comparable<Account> { | |
// Private prevent other classes from accessing or modifying these fields | |
private String holder; | |
private double balance; | |
// In Python, we write "self" to indicate the current object. | |
// In Java, we write "this" to indicate the current object. Note that the parameter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.HashMap; | |
public class Demo { | |
// Return type Argument type | |
public static List<Integer> countValues(Map<Integer, List<Integer>> entries) { | |
// result = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import aiohttp | |
import asyncio | |
import canvasapi | |
import itertools | |
import json | |
import pandas as pd | |
import requests | |
import nest_asyncio | |
nest_asyncio.apply() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(() => { | |
document.querySelector('.unassigned-students').remove(); | |
document.querySelector('.groups').classList.remove('span9'); | |
document.querySelectorAll('[aria-expanded="true"].toggle-group.group-heading').forEach(e => e.click()); | |
const groups = document.getElementsByClassName('toggle-group group-heading'); | |
const randomGroup = groups[Math.floor(Math.random() * groups.length)]; | |
randomGroup.click(); | |
randomGroup.scrollIntoView(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from canvasapi import Canvas | |
import os | |
if __name__ == "__main__": | |
canvas = Canvas("https://canvas.uw.edu", os.getenv("TOKEN")) | |
course = canvas.get_course(os.getenv("COURSE_ID")) | |
groups = course.get_groups() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from canvasapi import Canvas | |
import os | |
if __name__ == "__main__": | |
canvas = Canvas("https://canvas.uw.edu", os.getenv("TOKEN")) | |
course = canvas.get_course(os.getenv("COURSE_ID")) | |
groups = course.get_groups() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder