HTML
Simple HTML Page
<!DOCTYPE html>
<html>
<head><title>Hello</title></head>
<body>Hello World!</body>
</html>
HTML Table
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Alice</td><td>25</td></tr>
</table>
CSS
Center Content
.center {
display: flex;
justify-content: center;
align-items: center;
}
Button Styles
.btn {
padding: 10px 20px;
background: #3498db;
color: white;
border-radius: 4px;
}
JavaScript
Hello World
console.log("Hello, World!");
Random Number
function getRandom() {
return Math.floor(Math.random() * 100);
}
Event Listener
document.getElementById("btn")
.addEventListener("click", () => alert("Clicked!"));
Python
Hello World
print("Hello, World!")
Factorial Function
def factorial(n):
return 1 if n == 0 else n * factorial(n-1)
List Comprehension
squares = [x**2 for x in range(10)]
Other
JSON Example
{
"name": "Frank",
"age": 36,
"isStudent": false
}
Bash Script
#!/bin/bash
echo "Hello from bash!"