Skip to content

Instantly share code, notes, and snippets.

View bashbaugh's full-sized avatar
🐟
writing cod

Benjamin Ashbaugh bashbaugh

🐟
writing cod
View GitHub Profile
@echo off
ver
echo.
:Loop
set /P the="%cd%>"
%the%
echo.
goto loop
# An example .gitignore file
# You can use * to indicate any string of characters
# Git will ignore any files or directories that match the list below, when you run the git add . command.
*.log
*.pyc
*.swp
*.*swp
/credentials
/venv
~/Documents/learning-git $ git merge b
Auto-merging a.txt
CONFLICT (content): Merge conflict in a.txt
Automatic merge failed; fix conflicts and then commit the result.
~/Documents/learning-git $ git diff a b
... <-- You can ignore the lines right here for now, these are the important lines:
-Adam <-- this tells us that Adam was removed in branch b
+Bob <-- and this tells us that Bob was added.
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Game</title>
</head>
<body onload="init()">
<h1>JavaScript Game</h1>
<p>Here is a simple JavaScript game:</p>
<canvas id="c" width="400" height="400"></canvas>
// Remember, this is a comment because it is after two slashes.
// The web browser ignores comments - they are just for the humans.
function print_full_name(first_name, last_name) // Here we declare the function name and arguments
{ // <-- This starts the function
console.log("Here is a full name:"); // This line is run first when the function is called
// And then this line is run,
// which pieces together the first_name argument, a space, and the last_name argument to create a full name:
console.log(first_name + " " + last_name); // Which gets printed to the console.
} // <-- And then this tells the browser that the function is finished.
// Here are two name variables:
let some_first_name = "Bob";
let some_last_name = "Joe";
// Here we use them in the name printer function:
print_full_name(some_first_name, some_last_name);
// Or else we can change the first name:
print_full_name("Margaret", some_last_name);
// Or else we can make up both names:
print_full_name("Jane", "Smith");
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Game</title>
</head>
<body onload="init()">
<h1>JavaScript Game</h1>
<p>Here is a simple JavaScript game:</p>
<canvas id="c" width="400" height="400"></canvas>
function draw_background()
{
// First we erase everything on the canvas:
canvas.clearRect(0, 0, canvas_element.width, canvas_element.height);
// And then we change the color of our "paintbrush":
canvas.fillStyle = "#1EBA00";
// And then we draw a colored rectangle that covers the entire canvas:
canvas.fillRect(0, 0, canvas_element.width, canvas_element.height);
}
function init()
{
// Draw the background using the function we just created:
draw_background();
// Set the brush color to white:
canvas.fillStyle = "#FFFFFF";
// Set the font size and name:
canvas.font = "25px Arial";
// Draw the text onto the canvas:
canvas.fillText("Press the up arrow to start", 40, 200);
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Game</title>
</head>
<body onload="init()">
<h1>JavaScript Game</h1>
<p>Here is a simple JavaScript game:</p>
<canvas id="c" width="400" height="400"></canvas>