Skip to content

Instantly share code, notes, and snippets.

View gmelodie's full-sized avatar
🤟
Computing stuff

Gabriel Cruz gmelodie

🤟
Computing stuff
View GitHub Profile
@gmelodie
gmelodie / tic_input.html
Created January 27, 2019 17:08
Tic-tac-toe game
<html>
<script type="text/javascript">
function play() {}
</script>
<h1> Tic-tac-toe </h1>
<input type="radio" name="play" value="11">
<input type="radio" name="play" value="12">
<input type="radio" name="play" value="13">
<br>
@gmelodie
gmelodie / button_hello_anything.html
Last active January 27, 2019 15:26
JavaScript example, gets input text and shows in alert window
<html>
<script type="text/javascript">
function popup_window() {
alert(document.getElementById('input1').value);
}
</script>
<input name="window-text" type="text" id="input1">
<button onclick="popup_window()"> Submit </button>
</html>
@gmelodie
gmelodie / button_hello_world.html
Created January 27, 2019 15:14
Button to pop up
<html>
<script type="text/javascript">
function popup_window() {
alert("Hello World!");
}
</script>
<button onclick="popup_window()"> Hello World! </button>
</html>
@gmelodie
gmelodie / variable_use_js.html
Created January 27, 2019 14:59
Javascript variable usage example
<html>
<script type=text/javascript>
let some_number = 1;
alert(some_number);
</script>
</html>
@gmelodie
gmelodie / hello_world_js.html
Created January 26, 2019 13:04
Javascript hello world usign alert
<html>
<script type=text/javascript>
alert("Hello World!");
</script>
</html>
@gmelodie
gmelodie / insert_vote_db.php
Last active January 23, 2019 18:38
Small correction to vote_db_v3.php
<?php
// Insert data to database
if ($_POST["liked"] === "yes") {
$vote = TRUE;
} else {
$vote = FALSE;
}
$insert = "INSERT INTO vote (id, liked) VALUES ('" . $_SERVER['REMOTE_ADDR'] . "', " . $vote . ")";
@gmelodie
gmelodie / vote_db_v3.php
Created January 23, 2019 18:27
Vote page with database version 3
<html>
<!-- SAME OLD CRAP -->
<?php
$servername = "localhost";
$username = "gabriel";
$password = "my_secret_password";
$dbname = "herschel";
@gmelodie
gmelodie / vote_db_v2.php
Last active January 23, 2019 18:18
Vote page with database access version 2
<html>
<!-- SAME OLD CRAP -->
<?php
$servername = "localhost";
$username = "gabriel";
$password = "my_secret_password";
$dbname = "herschel";
@gmelodie
gmelodie / vote_db_v1.php
Created January 22, 2019 19:00
Vote page with database access
<html>
<!-- SAME OLD CRAP -->
<?php
$servername = "localhost";
$username = "root";
$password = "my_root_password";
$dbname = "herschel";
@gmelodie
gmelodie / ip_tell.php
Created January 22, 2019 18:32
PHP page that tells us our IP address
<html>
<h1> Telling your IP </h1>
<?php
echo "Your IP is " . $_SERVER['REMOTE_ADDR'];
?>
</html>