initial commit

This commit is contained in:
2023-11-11 11:23:51 -07:00
parent 9068d4bd33
commit 6d6e138210
261 changed files with 23107 additions and 2 deletions

View File

@@ -0,0 +1,151 @@
# Python Cheat Sheet
## 1. Variables, Data Types, and Basic Operations
Python has several fundamental data types, including integers (int), floating point numbers (float), and strings (str). Python is a dynamically typed language, which means you don't need to declare the data type of a variable when you define it.
```python
a = 10 # Integer
b = 3.14 # Float
c = "Hello, World!" # String
```
Operators allow you to perform operations on variables. Arithmetic, comparison, assignment, logical, and identity operators are some of the main types in Python.
```python
a = 10
b = 20
sum = a + b # Addition
difference = a - b # Subtraction
#... remaining code ...
```
## 2. Control Structures (Conditionals and Loops)
Python uses `if`, `elif`, and `else` for conditional statements. Loops in Python can be programmed using a `for` or `while` loop.
```python
# If-else statement
if a > b:
print("a is greater than b")
else:
print("a is not greater than b")
# For loop
for i in range(5):
print(i)
```
## 3. Functions
Functions in Python are defined using the `def` keyword. They are used to encapsulate a piece of code that performs a specific task.
```python
def greet(name):
print("Hello, " + name)
greet("Alice")
```
## 4. Lists, Tuples, Sets, and Dictionaries
Python has several types of compound data structures that can hold multiple values, including lists, tuples, sets, and dictionaries.
```python
# Lists
my_list = [1, 2, 3, 4, 5]
# Dictionaries
my_dict = {"apple": 1, "banana": 2, "cherry": 3}
```
## 5. File Handling
Python has built-in functions for reading and writing files. `open()` function is used to open a file. It returns a file object and is most commonly used with two arguments: `open(filename, mode)`.
```python
# Reading a file
file = open('file.txt', 'r')
content = file.read()
file.close()
# Writing to a file
file = open('file.txt', 'w')
file.write("Hello, World!")
file.close()
```
## 6. Exception Handling
Python uses `try` and `except` blocks to catch and handle exceptions. Python executes code following the `try` statement as a "normal" part of the program. The code that follows the `except` statement is the program's response to any exceptions in the preceding try clause.
```python
try:
# Code that may raise an exception
x = 1 / 0
except ZeroDivisionError:
print("You can't divide by zero!")
```
## 7. Classes and Objects
Python is an object-oriented programming language. You define classes to create your own types.
```python
class MyClass:
x = 5
p1 = MyClass() # Create an object of MyClass
print(p1.x) # Access the properties of MyClass using the object
```
## 8. Modules and Packages
Modules in Python are simply Python files with a .py extension, which implement a set of functions. A package is a way of organizing related modules into a single directory hierarchy.
```python
# Importing a module
import math
print(math.sqrt(16)) # Use a function from the math module
# Importing
ChatGPT
a package
import os.path
print(os.path.join('/a', 'b', 'c')) # Use a function from the os.path package
```
## 9. Working with JSON
Python has a built-in package called `json`, which can be used to work with JSON data.
```python
import json
# Some JSON:
x = '{"name": "John", "age": 30, "city": "New York"}'
# Parse x:
y = json.loads(x)
# The result is a Python dictionary:
print(y["age"])
```
## 10. Making HTTP requests
The `requests` library is the de facto standard for making HTTP requests in Python. It abstracts the complexities of making requests behind a beautiful, simple API so that you can focus on interacting with services and consuming data in your application.
```python
import requests
response = requests.get('https://www.example.com')
# Print the status code
print(response.status_code)
# Print the content
print(response.text)
```
These are the basics to get you started with Python! Each of these topics has more depth to explore as you become more comfortable with the language.

View File

@@ -0,0 +1,151 @@
# Python Cheat Sheet
## 1. Variables, Data Types, and Basic Operations
Python has several fundamental data types, including integers (int), floating point numbers (float), and strings (str). Python is a dynamically typed language, which means you don't need to declare the data type of a variable when you define it.
```python
a = 10 # Integer
b = 3.14 # Float
c = "Hello, World!" # String
```
Operators allow you to perform operations on variables. Arithmetic, comparison, assignment, logical, and identity operators are some of the main types in Python.
```python
a = 10
b = 20
sum = a + b # Addition
difference = a - b # Subtraction
#... remaining code ...
```
## 2. Control Structures (Conditionals and Loops)
Python uses `if`, `elif`, and `else` for conditional statements. Loops in Python can be programmed using a `for` or `while` loop.
```python
# If-else statement
if a > b:
print("a is greater than b")
else:
print("a is not greater than b")
# For loop
for i in range(5):
print(i)
```
## 3. Functions
Functions in Python are defined using the `def` keyword. They are used to encapsulate a piece of code that performs a specific task.
```python
def greet(name):
print("Hello, " + name)
greet("Alice")
```
## 4. Lists, Tuples, Sets, and Dictionaries
Python has several types of compound data structures that can hold multiple values, including lists, tuples, sets, and dictionaries.
```python
# Lists
my_list = [1, 2, 3, 4, 5]
# Dictionaries
my_dict = {"apple": 1, "banana": 2, "cherry": 3}
```
## 5. File Handling
Python has built-in functions for reading and writing files. `open()` function is used to open a file. It returns a file object and is most commonly used with two arguments: `open(filename, mode)`.
```python
# Reading a file
file = open('file.txt', 'r')
content = file.read()
file.close()
# Writing to a file
file = open('file.txt', 'w')
file.write("Hello, World!")
file.close()
```
## 6. Exception Handling
Python uses `try` and `except` blocks to catch and handle exceptions. Python executes code following the `try` statement as a "normal" part of the program. The code that follows the `except` statement is the program's response to any exceptions in the preceding try clause.
```python
try:
# Code that may raise an exception
x = 1 / 0
except ZeroDivisionError:
print("You can't divide by zero!")
```
## 7. Classes and Objects
Python is an object-oriented programming language. You define classes to create your own types.
```python
class MyClass:
x = 5
p1 = MyClass() # Create an object of MyClass
print(p1.x) # Access the properties of MyClass using the object
```
## 8. Modules and Packages
Modules in Python are simply Python files with a .py extension, which implement a set of functions. A package is a way of organizing related modules into a single directory hierarchy.
```python
# Importing a module
import math
print(math.sqrt(16)) # Use a function from the math module
# Importing
ChatGPT
a package
import os.path
print(os.path.join('/a', 'b', 'c')) # Use a function from the os.path package
```
## 9. Working with JSON
Python has a built-in package called `json`, which can be used to work with JSON data.
```python
import json
# Some JSON:
x = '{"name": "John", "age": 30, "city": "New York"}'
# Parse x:
y = json.loads(x)
# The result is a Python dictionary:
print(y["age"])
```
## 10. Making HTTP requests
The `requests` library is the de facto standard for making HTTP requests in Python. It abstracts the complexities of making requests behind a beautiful, simple API so that you can focus on interacting with services and consuming data in your application.
```python
import requests
response = requests.get('https://www.example.com')
# Print the status code
print(response.status_code)
# Print the content
print(response.text)
```
These are the basics to get you started with Python! Each of these topics has more depth to explore as you become more comfortable with the language.

View File

@@ -0,0 +1,92 @@
## Pseudocode Cheat Sheet
**Pseudocode** is a simple way of expressing programming logic in plain language. It's a valuable tool to outline algorithms, aiding in understanding and problem-solving without using specific programming language syntax.
**Why Use Pseudocode?**
Pseudocode can be employed in various situations, especially when planning and brainstorming programming solutions. Its uses extend to:
- **Problem Understanding:** It simplifies problem comprehension by breaking it down into manageable steps.
- **Solution Design:** It aids in creating efficient solutions by enabling more precise visualization of the logical flow.
- **Coding:** It provides a high-level overview of the code to be written, simplifying the coding process.
- **Debugging:** It helps identify logic errors before actual code is written, simplifying debugging.
- **Collaboration:** It aids in explaining the logic to others, especially those unfamiliar with specific programming languages.
- **Maintainability:** It serves as a blueprint of the logic for future reference, enhancing code maintainability.
**Guidelines for Writing Pseudocode**
- **Natural Language:** Use plain English or your preferred natural language. If a part of the pseudocode is complex, consider adding comments for better clarity.
- **Avoid Specific Syntax:** Avoid language-specific syntax to keep the pseudocode universally understandable.
- **Logic Emphasis:** Center your focus on the algorithm's logic.
- **Flow of Control:** Clearly illustrate the flow of control using sequences (steps following each other), selections (decisions based on conditions), and iterations (loops).
- **Consistency:** Ensure the terminology is consistent and clear to enhance understandability.
**Pseudocode: A Step-by-step Approach**
1. **Understand the Problem:** Clearly define what the problem is asking for.
2. **Plan Your Approach:** Brainstorm possible ways to solve the problem.
3. **Write the Pseudocode:** Describe the steps to solve the problem in plain language.
4. **Utilize Control Structures:** Incorporate sequences, selections, and iterations to control the flow of the pseudocode.
5. **Indent for Clarity:** Use indentation to show hierarchy and structure in your pseudocode.
6. **Avoid Language-Specific Syntax:** Ensure your pseudocode is language-agnostic.
7. **Review and Refine:** Go through your pseudocode, making sure it makes sense and is complete. Revise as necessary.
8. **Translate to Code:** Convert your pseudocode into the chosen programming language.
9. **Test and Revise:** Ensure your program behaves as expected by testing the code. If problems arise, revising the pseudocode may be necessary.
**Key Words and Phrases in Pseudocode**
| Category | Keywords |
| --------------------- | -------------------------------------------------------------------- |
| Sequence | First, Second, Then, After, Next, Finally |
| Selection | If, Else, Then, Otherwise, Choose, Depending on |
| Iteration | While, For, Do Until, Repeat Until, Loop, Repeat, Until, Each, Times |
| Input/Output | Read, Print, Display, Input, Output, Get, Show |
| Arithmetic Operations | Add, Subtract, Multiply, Divide, Calculate, Compute |
| Comparisons | Equals, Greater than, Less than, Not equal to |
| Data Manipulation | Set, Reset, Increment, Update, Append, Remove |
**Remember to adjust these according to the conventions used in your team or organization.**
**Examples of Pseudocode**
**Tip Calculator**
```pseudocode
# Print instructions to user
Print "Enter the total bill:"
Read totalBill
Print "Enter the desired tip percentage:"
Read tipPercentage
# Calculate the tip amount
Set tipAmount to (totalBill \* (tipPercentage / 100))
# Calculate the total with tip
Set totalWithTip to totalBill + tipAmount
# Round the total down to the nearest whole dollar
Set finalTotal to Floor(totalWithTip)
# Print the final total to the user
Print "The total bill including tip is", finalTotal
```
**Currency Converter**
```pseudocode
# Print instructions to user
Print "Enter the amount in your source currency:"
Read sourceAmount
Print "Enter the conversion rate to the target currency:"
Read conversionRate
# Calculate the equivalent amount in the target currency
Set targetAmount to sourceAmount \* conversionRate
# Print the amount in the target currency to the user
Print "The amount in the target currency is", targetAmount
```
**Conclusion**
Pseudocode is a valuable tool that can help you to write more efficient, maintainable, and bug-free code. By following the guidelines and best practices outlined in this cheat sheet, you can improve your pseudocode writing skills and become a better programmer.

View File

@@ -0,0 +1,194 @@
# Coding Standards Documentation
## Introduction
This document outlines the common HTML class naming conventions and structure to ensure consistent, readable, and maintainable code in our web projects.
## Buttons
- `.btn`:
- **Description**: Used to style generic buttons.
- **Example**: `<button class="btn">Click Me</button>`
- `.btn--large`:
- **Description**: Styles large buttons.
- **Example**: `<button class="btn btn--large">Large Button</button>`
- `.btn--small`:
- **Description**: Styles small buttons.
- **Example**: `<button class="btn btn--small">Small Button</button>`
## Layout
- `.container`:
- **Description**: Wraps the main content of a web page, centering the content and limiting its width.
- **Example**: `<div class="container">...</div>`
- `.row`:
- **Description**: Creates horizontal rows of elements.
- **Example**: `<div class="row">...</div>`
- `.col`:
- **Description**: Divides a `.row` into vertical columns. Width is often defined by additional classes or styles.
- **Example**: `<div class="col">...</div>`
## Sections
- `.header`:
- **Description**: Styles the top section of a web page, including the navigation bar and logo.
- **Example**: `<header class="header">...</header>`
- `.main`:
- **Description**: Styles the main content area of a web page.
- **Example**: `<main class="main">...</main>`
- `.footer`:
- **Description**: Styles the footer of a web page.
- **Example**: `<footer class="footer">...</footer>`
## Forms
- `.form`:
- **Description**: Styles the entirety of forms.
- **Example**: `<form class="form">...</form>`
- `.input`:
- **Description**: Can style multiple form elements. Specific classes should be used for distinct input types.
- **Example**: `<input type="text" class="input">`
- `.text`, `.password`, `.checkbox`, `.radio`:
- **Description**: Styles individual types of inputs.
- **Examples**:
- Text: `<input type="text" class="text">`
- Password: `<input type="password" class="password">`
- Checkbox: `<input type="checkbox" class="checkbox">`
- Radio: `<input type="radio" class="radio">`
## Tables
- `.table`:
- **Description**: Used to style tables of data.
- **Example**: `<table class="table">...</table>`
## Images
- `.image`:
- **Description**: Styles generic images.
# Usage of Inline and Block Elements
Understanding the difference between inline and block elements is pivotal for structuring and styling web content effectively.
## Inline Elements
Inline elements do not start on a new line and take up as much width as necessary. They're like words in a sentence — they flow with the content.
Examples include:
- **Links (`<a>`):** Hyperlinks to another resource.
- **Usage**: `<a href="https://example.com">Visit Example</a>`
- **Images (`<img>`):** Embeds an image.
- **Usage**: `<img src="path/to/image.jpg" alt="Description">`
- **Strong Emphasis (`<strong>`):** Denotes strong importance, typically displayed as bold.
- **Usage**: `<strong>Important text.</strong>`
- **Emphasis (`<em>`):** Gives emphasized text, usually rendered as italic.
- **Usage**: `<em>Emphasized text.</em>`
- **Code (`<code>`):** Designates a single line of code.
- **Usage**: `<code>let x = 10;</code>`
- **Span (`<span>`):** Generic inline container for phrasing content. Doesn't convey any meaning on its own.
- **Usage**: `<span class="highlight">Highlighted text</span>`
- **Abbreviations (`<abbr>`):** Represents an abbreviation or acronym.
- **Usage**: `<abbr title="HyperText Markup Language">HTML</abbr>`
- **Inline Quotation (`<q>`):** Denotes a short inline quotation.
- **Usage**: `<q>Cogito, ergo sum</q>`
## Block Elements
Block elements start on a new line and typically take up the full width of their parent container.
Examples include:
- **Paragraphs (`<p>`):** Denotes a block of text.
- **Usage**: `<p>This is a paragraph.</p>`
- **Headings (`<h1>` to `<h6>`):** Mark section headings, with `<h1>` being the most prominent and `<h6>` the least.
- **Usage**:
- `<h1>Main Title</h1>`
- `<h2>Subheading</h2>`
- ...
- `<h6>Smallest Subheading</h6>`
- **Lists:**
- **Unordered (`<ul>`):** List without a specific order.
- **Usage**:
```html
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
```
- **Ordered (`<ol>`):** Numbered list.
- **Usage**:
```html
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
```
- **Description (`<dl>`):** List of terms with their descriptions.
- **Usage**:
```html
<dl>
<dt>Browser</dt>
<dd>A software used to access the web.</dd>
</dl>
```
- **Divisions (`<div>`):** Generic container that groups content.
- **Usage**: `<div class="section">...</div>`
- **Block Quotation (`<blockquote>`):** Represents a section quoted from another source.
- **Usage**:
```html
<blockquote cite="sourceURL">
This is a block quote from another source.
</blockquote>
```
- **Tables (`<table>`):** Represents tabular data.
- **Usage**:
```html
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
```
- **Forms (`<form>`):** Represents an interactive form.
- **Usage**:
```html
<form action="/submit">
<input type="text" name="name">
<input type="submit" value="Submit">
</form>
```
- **Preformatted Text (`<pre>`):** Displays text with whitespace preserved, often used with `<code>`.
- **Usage**:
```html
<pre>
function hello() {
console.log("Hello, world!");
}
</pre>
```
- **Figures (`<figure>` and `<figcaption>`):** Used to mark up a photo or graphic with an optional caption.
- **Usage**:
```html
<figure>
<img src="path/to/image.jpg" alt="Description">
<figcaption>Caption for the image.</figcaption>
</figure>
```
## Conclusion
Choosing the correct element—whether inline or block—enhances the semantic value of the content, improves accessibility, and makes styling more straightforward.
- **Example**: `<img src="path/to/image.jpg" class="image" alt="Description">`
- `.img-responsive`:
- **Description**: Ensures images are responsive and adjust to their container's width.
- **Example**: `<img src="path/to/image.jpg" class="img-responsive" alt="Description">`
## Conclusion
By adhering to these naming conventions and standards, we ensure that our code remains consistent across projects, making it easier for developers to collaborate, maintain, and extend the codebase.

View File

@@ -0,0 +1,168 @@
## Feedback on Plans for Learning
Your plans for learning are detailed and purposefully directed towards achieving your goal of becoming a web developer. Here are some refined suggestions for enhancing your strategy:
- **Daily Practice:** Dedicate a minimum of 30 minutes daily to learn and practice. Consistent effort accumulates over time.
- **Community Engagement:** Seek help and share your progress in online communities such as [Stack Overflow](https://stackoverflow.com/) and [Reddit's r/webdev](https://www.reddit.com/r/webdev/) to foster learning through collaboration.
- **Patience:** Web development is intricate and may sometimes be frustrating. Remember, every expert was once a beginner. Persist with your efforts.
## SMART Goals for Training Plan
Refine your SMART goals as follows:
- **Specific:** Craft a basic webpage using HTML and CSS, incorporating at least one CSS framework by the end of the sixth week.
- **Measurable:** Complete all assignments in your ongoing [mention the specific course name] web development course.
- **Achievable:** Allocate a fixed 30 minutes daily for web development learning.
- **Relevant:** Stay focused on acquiring skills pivotal to web development, keeping abreast with the latest industry trends.
- **Time-bound:** Finish your web development course within a span of six months, setting a steady pace for learning.
## Weekly Training Schedule (Week 1)
Below is a more structured weekly schedule with practical tasks:
### Day 1
- **Objective:** Grasp the role and fundamental features of HTML in web development.
- **Resources:**
- [HTML Tutorial](https://www.w3schools.com/html/)
- [HTML Crash Course](https://www.theodinproject.com/lessons/foundations-introduction-to-html-and-css)
### Day 2
- **Objective:** Learn about the structural elements of an HTML document, focusing on <!DOCTYPE>, <html>, <head>, and <body>.
- **Resources:**
- [HTML Document Structure](https://www.w3.org/TR/html401/struct/global.html)
- [HTML Document Structure Tutorial](https://www.reddit.com/r/webdev/comments/q9f82u/i_made_a_detailed_walkthrough_of_the_odin/)
### Day 3
- **Objective:** Acquaint yourself with common HTML tags used to format a webpage.
- **Resources:**
- [HTML Tags](https://www.w3schools.com/tags/tag_html.asp)
- [HTML Tags Tutorial](https://www.theodinproject.com/lessons/foundations-elements-and-tags)
### Days 4-5
- **Practice:** Create a simplistic HTML webpage utilizing the tags learned. Share it with friends or online communities for feedback.
- **Resources:**
- [HTML Tutorial](https://www.w3schools.com/html/)
- [HTML Crash Course](https://www.theodinproject.com/lessons/foundations-introduction-to-html-and-css)
## Tips for a Fruitful Training Plan
Here are some actionable tips to augment your learning journey:
- **Prioritize Tasks:** Utilize the Eisenhower Matrix or ABCDE method to focus on high-priority tasks, optimizing your learning path.
- **Breaks:** Regular short breaks can prevent burnout and enhance focus. Ensure to take breaks during your learning sessions.
- **Mentorship:** Seek a mentor through platforms such as [LinkedIn](https://www.linkedin.com/) or local web development communities. A mentor can provide constructive feedback and guidance.
Remember to track your progress regularly to identify strengths and areas needing improvement. Wishing you the best in your web development learning journey!
and the following training plan:
## 24-Week Training Plan
### Step 1: Divide your training into smaller, manageable sections.
Break down your 24-week training plan into smaller, more manageable sections. For example, you could divide it into three 8-week phases, or four 6-week phases.
### Step 2: Assign specific weekly topics and objectives.
Once you have divided your training plan into sections, assign specific weekly topics and objectives. For example, in Week 1, you might focus on learning the basics of HTML and CSS. In Week 2, you might focus on building a simple webpage.
### Step 3: Create a Google Calendar for your training plan.
Create a new Google Calendar specifically for your 24-Week Training Plan. Set up all-day events for each week, and include reminders at the beginning of the week to help you stay focused.
### Step 4: Use Todoist to break down weekly objectives into daily tasks.
Use Todoist to break down your weekly objectives into daily tasks. Create a new project called "24-Week Training Plan" and set up sections for each week.
### Step 5: Allocate time for learning, practicing, and reviewing your progress.
Allocate time for learning new concepts, practicing, and reviewing your progress. Use time blocking or the Pomodoro Technique to allocate focused time to tasks and avoid multitasking.
### Step 6: Prioritize tasks based on importance and urgency.
Prioritize your tasks based on importance and urgency using the Eisenhower Matrix or ABCDE method. Focus on high-impact tasks first and address lower-priority tasks when time permits.
### Step 7: Set up a Trello board for your training plan.
Set up a Trello board for your 24-week training plan. Create lists for workflow stages (e.g., To Do, In Progress, Review, Completed), and add cards for tasks and objectives. Move cards between lists as you progress.
### Step 8: Organize your learning materials in Google Drive.
Organize your learning materials in Google Drive by creating folders for each week and adding documents, resources, and project files as needed.
### Step 9: Use automation tools to automate repetitive tasks or sync data.
Use automation tools like Zapier or Integromat to automate repetitive tasks or sync data between Google Calendar, Todoist, Trello, and Google Drive.
### Step 10: Use browser extensions to quickly add tasks or cards.
Use browser extensions like Todoist for Chrome or Trello for Chrome to quickly add tasks or cards without leaving your current webpage.
### Step 11: Set SMART goals and track your progress.
Set SMART goals for your training plan and track your progress regularly. Use tools like RescueTime or Clockify to monitor your time spent on tasks and identify areas for improvement.
### Step 12: Schedule regular breaks and leisure activities.
Schedule regular breaks and leisure activities to maintain a healthy work-life balance and prevent burnout.
### Step 13: Collaborate with others and seek feedback.
If you are working with others, use tools like Slack or Microsoft Teams to streamline communication and collaborate effectively. Schedule regular check-ins or meetings to discuss progress and share feedback.
### Step 14: Periodically review and adjust your workflow.
Periodically review your workflow and make adjustments based on your experiences, new tools, or changing priorities. Seek feedback from others who have successfully completed similar training programs or have expertise in the field.
**Additional tips:**
- Find a learning method that works best for you. Some people learn best by reading, while others learn best by watching or doing.
- Don't be afraid to ask for help. If you are struggling with a particular concept or task, reach out to a mentor, friend, or online community for assistance.
- Celebrate your successes. As you progress through your training plan, take the time to celebrate your accomplishments. This will help you stay motivated and on track.
## 24-Week Training Plan
**Week 1-4:**
- Introduction to web development history and terminology
- HTML fundamentals
- CSS fundamentals
- Web design principles
**Week 5-10:**
- CSS frameworks (e.g., Bootstrap, Tailwind CSS)
- JavaScript fundamentals
- DOM manipulation
- Asynchronous JavaScript
- Web accessibility and performance
**Week 11-14:**
- Svelte framework fundamentals
- State management and routing in Svelte
- Building small projects with Svelte
- Website project planning and collaboration
**Throughout the plan:**
- Allocate adequate time for practice and project work
- Schedule regular breaks and leisure activities
**Additional suggestions:**
- Use a learning management system (LMS)
- Join a study group or online community
- Seek out mentors or coaches
**Tips for success:**
- Be dedicated and hardworking
- Focus on learning the core concepts
- Practice regularly
- Build projects to apply your skills
- Get feedback from others