Skip to content

Instantly share code, notes, and snippets.

@fisherds
fisherds / dynamic_demo.py
Created January 4, 2025 14:47
Example of generating server side content
import random
def generate_dynamic_response_body(dict):
#build up string programmatically
response_body = """
<html>
<head>
<title>Dynamic Demo</title>
<link rel="stylesheet" href="styles/style.css">
import socket
import time
import signal
#added for parsing urls
import urllib
#added for tracing prints
import traceback
@fisherds
fisherds / httpserver.py
Created December 16, 2024 19:45
second http server TODOs
# Done: get the Request Method
request_method = request_line.split(' ')[0]
file_name = "." + request_line.split(' ')[1]
file_extension = file_name.split(".")[2]
# Done: read all Request Headers into a dictionary.
headers = {}
while True:
header_line = reader_from_browser.readline().decode("utf-8")
@fisherds
fisherds / selectors.html
Created December 11, 2024 18:43
Starting code for a CSS in-class activity Day 6
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Selectors</title>
<style>
</style>
</head>
@fisherds
fisherds / defines.ino
Created October 30, 2024 12:11
Exam 2 Fall 2024-2025 defines
// Pin 10 - Left LED Orange
#define REG_DDR_LED_ORANGE DDR_
#define REG_PORT_LED_ORANGE PORT_
#define BIT_LED_ORANGE _
// Pin 3 - Left Pushbutton Orange
#define REG_DDR_BUTTON_ORANGE DDR_
#define REG_PORT_BUTTON_ORANGE PORT_
#define REG_PIN_BUTTON_ORANGE PIN_
#define BIT_BUTTON_ORANGE _
@fisherds
fisherds / matching_game_tests.dart
Created September 19, 2023 13:17
My unit testing file for Matching Game
import 'package:exam1_emoji_matching/emoji_matching_game.dart';
import 'package:test/test.dart';
void main() {
late MatchingGame game3;
late MatchingGame game5;
late MatchingGame game10;
setUp(() {
game3 = MatchingGame(3);
game10 = MatchingGame(10);
@fisherds
fisherds / tic_tac_toe_game_test.dart
Last active September 8, 2023 02:24
Unit testing for the Tic-Tac-Toe model object
import "package:test/test.dart";
import "tic_tac_toe_game.dart";
void main() {
late TicTacToeGame game;
setUp(() {
game = TicTacToeGame();
});
test("Initial Game", () {
expect(game.state, equals(TicTacToeState.xTurn));
@fisherds
fisherds / rosefire.min.js
Created July 22, 2023 02:33
A file for using the Rosefire api for Rose-Hulman login
! function (e) {
var n = function (e) {
var n = e.split(".")[1];
if (n = JSON.parse(atob(n)), n.d) n = n.d;
else {
var r = n.uid;
n = n.claims, n.uid = r
}
return {
token: e,
@fisherds
fisherds / rosegraphics.py
Created April 6, 2023 18:54
Graphics helper library
"""
rosegraphics.py - a simple Graphics library for Python.
Its key feature is:
-- USING this library provides a simple introduction to USING objects.
Other key features include:
-- It has a rich set of classes, methods and instance variables.
In addition to classes like Circles that are natural for students,
it has other kinds of classes like RoseWindow and SimpleTurtle
@fisherds
fisherds / rosegraphics.py
Created March 2, 2023 19:07
Helper library used at Rose-Hulman for simple graphics
"""
rosegraphics.py - a simple Graphics library for Python.
Its key feature is:
-- USING this library provides a simple introduction to USING objects.
Other key features include:
-- It has a rich set of classes, methods and instance variables.
In addition to classes like Circles that are natural for students,
it has other kinds of classes like RoseWindow and SimpleTurtle