Skip to content

Instantly share code, notes, and snippets.

View okanaganrusty's full-sized avatar

Russell McConnachie okanaganrusty

View GitHub Profile
@okanaganrusty
okanaganrusty / server.py
Created November 4, 2025 02:53
server.py
from flask import Flask, send_file, jsonify
# This line creates a Flask webserver object, it states that
# the static_url_path should be empty, meaning that all of our
# files in our current directory are served directly from ./
# which includes index.html, script.js, style.css and server.py.
app = Flask(__name__, static_url_path='', static_folder='./')
# This handles our tic-tac-toe application, it means when someone
# goes to the root path of our application as defined by `/` it
@okanaganrusty
okanaganrusty / install_flask.py
Created November 4, 2025 01:36
install_flask.py
import pip
if __name__ == "__main__":
pip.main(["install", "flask"])
@okanaganrusty
okanaganrusty / number-guessing-game.py
Last active October 30, 2025 02:52
number-guessing-game.py
import random
from tkinter import *
from tkinter import ttk
random_number = random.randint(1, 100)
maximum_guesses = 10
current_guesses = 0
# Create the root window object in Python which we will be binding our GUI objects to.
@okanaganrusty
okanaganrusty / code1.py
Created October 28, 2025 02:35
code1.py
import requests
r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))
print(r.status_code)
print(r.headers)
print(r.text)
@okanaganrusty
okanaganrusty / script.js
Last active November 4, 2025 02:45
script.js
document.addEventListener("DOMContentLoaded", () => {
var board = [
document.getElementById("col1"),
document.getElementById("col2"),
document.getElementById("col3"),
document.getElementById("col4"),
document.getElementById("col5"),
document.getElementById("col6"),
document.getElementById("col7"),
document.getElementById("col8"),
@okanaganrusty
okanaganrusty / style.css
Last active October 27, 2025 16:39
style.css
div.container {
display: grid;
grid-template-areas:
"col1 col2 col3"
"col4 col5 col6"
"col7 col8 col9"
"button button button";
grid-template-columns: 150px 150px 150px;
grid-template-rows: 150px 150px 150px;
gap: 10px;
@okanaganrusty
okanaganrusty / grid-layout.html
Last active October 27, 2025 16:38
grid-layout.html
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1>Tic tac toe</h1>
@okanaganrusty
okanaganrusty / dice.html
Created October 21, 2025 02:38
dice.html
<!DOCTYPE html>
<html>
<head>
<script src="dice.js" type="text/javascript"></script>
</head>
<body>
<div style="border: 5px solid blue">
<img id="current_die" src="blank.png" alt="blank" />
</div>
@okanaganrusty
okanaganrusty / dice.js
Created October 21, 2025 02:38
dice.js
const dice = new Array(6);
dice[0] = "die1.png";
dice[1] = "die2.png";
dice[2] = "die3.png";
dice[3] = "die4.png";
dice[4] = "die5.png";
dice[5] = "die6.png";
function rollRandomDie() {
@okanaganrusty
okanaganrusty / f2c.html
Last active October 21, 2025 01:43
f2c.html
<!DOCTYPE html>
<html>
<head>
<script src="lesson3.js" type="text/javascript"></script>
</head>
<body>
<form action="#">
<label>Temperature in celsius</label>
<input type="text" id="celsius" name="celsius" />