Skip to content

Instantly share code, notes, and snippets.

View misterhtmlcss's full-sized avatar

Roger Kondrat misterhtmlcss

View GitHub Profile
@misterhtmlcss
misterhtmlcss / number_game.js
Last active October 15, 2015 22:20
1st JS Game - Number guessing
var target, guess_input, guess_input_text;
var finished = false;
var guesses = 0;
function guessing_game() {
var random_number = Math.random() * 100;
var random_number_integer = Math.floor(random_number);
target = random_number_integer + 1;
while (!finished) {
guess_input_text = prompt("Guess what number I'm thinking of? ");
// I was thinking about making this a nice HTML page... another day perhaps
Working with Strings:
[textNormalizer.js] https://gist.github.com/misterhtmlcss/b6f1ef8a76308c975c2faac4951acdd5
[Shouter.js] https://gist.github.com/misterhtmlcss/6bb9b08d140b57b0dddf472eb26c4443
[wisePerson.js] https://gist.github.com/misterhtmlcss/20126d550d9019652639b38ae8079e0b
Working with Numbers:
@misterhtmlcss
misterhtmlcss / learning-journal-u2-b.py
Created July 3, 2020 04:48
learning-journal-u2-b
"""
# Part 2
Write your own function that illustrates a feature that you learned in this unit. The function must take at least one argument. The function should be your own creation, not copied from any other source. Do not copy a function from your textbook or the Internet.
Include all of the following in your Learning Journal:
The code for the function that you invented.
The inputs and outputs to three calls of your invented function.
A description of what feature(s) your function illustrates.
@misterhtmlcss
misterhtmlcss / unit-3-princewill.py
Created July 7, 2020 17:49
Discussion from Unit 3 - UoPeople
# x = -10
# x = 0
# x = 2
if x != 0:
print("This number ", x, " is not 0.")
else:
print(x, " is 0")
# I think the not operator is interesting.
# **************************
# CS1101 - Discussion Unit 5
# **************************
# **************************
# Instructions
# 1. Check whether its argument has any lowercase letters
# 2. Describe what it actually does when called with a string argument and if it does not correctly check for lowercase letters.
# 4. Give an example argument that produces incorrect results. (SEE BOTTOM for 3 calls to all functions!)
# 5. Describe why the result is incorrect. (SEE inline comments)
# Describe how catching exceptions can help with file errors. Write three Python examples that actually generate file errors on your computer and catch the errors with try: except: blocks. Include the code and output for each example in your post.
# There are two ways to catch an error; handle it gracefully, which is done in the last except statement, but in the first one with ZeroDivisionError we apply the initial part of second implementation that is more dynamic and some would say 'useful' to the user and development team. When an exception is specifically targeted this allows for a software developer to more easily develop an 'antidote' to the issue. In this case division by 0. Possibly this could lead to a solution that upon exception returns 0.
# Describe how catching exceptions can help with file errors.
# Catching errors can mean two things; the graceful handling of your program failing. Rather than a crash! Can anyway anyway 2k bug? This means your code is more durable to errors.
def test_excepti
@misterhtmlcss
misterhtmlcss / link-highjacker.js
Created September 8, 2020 18:21
How to solve a problem when you develop code.
@misterhtmlcss
misterhtmlcss / index.html
Last active September 9, 2020 14:43
TIC-Homepage
<!DOCTYPE html>
<html lang="en">
<head>
<!--
The following 2 meta tags *must* come first in the <head>
to consistently ensure proper document rendering.
Any other head element should come *after* these tags.
-->
<meta charset="UTF-8">
@misterhtmlcss
misterhtmlcss / Lecture-Selectors-Transtions.md
Last active September 11, 2020 15:55
Lecture on Selectors and Transitions

Lecture on Selectors and Transitions

  • Selectors
  • Transitions
@misterhtmlcss
misterhtmlcss / learning-journal-u2-a.py
Last active November 24, 2021 06:04
learning-journal-u2-a
"""
# Part 1
The volume of a sphere is 4/3πr3, where π has the value of "pi" given in Section 2.1 of your textbook. Write a function called print_volume (r) that takes an argument for the radius of the sphere, and prints the volume of the sphere.
Call your print_volume function three times with different values for radius.
Include all of the following in your Learning Journal:
- The code for your print_volume function.
- The inputs and outputs to three calls of your print_volume.