No more cards!
JavaScript
// Function to calculate the sum of an array
const calculateSum = (numbers) => {
let sum = 0;
for (let i = 0; i < numbers.length; i++) {
sum += numbers[i];
}
return sum;
};HUMAN
AI
JavaScript
// fast path for small arrays
const sum = (arr) => {
if (arr.length === 0) return 0;
return arr.reduce((a, b) => a + b, 0);
};HUMAN
AI
Python
def get_user_data(user_id):
"""
Retrieves user data from the database.
Args:
user_id (int): The ID of the user.
Returns:
dict: The user data.
"""
try:
user = db.get(user_id)
return user
except Exception as e:
print(f"Error: {e}")
return NoneHUMAN
AI
Python
def fetch_user(id):
# db.get handles 404s internally
return db.get(id) or {}HUMAN
AI
React
const UserProfile = ({ user }) => {
if (!user) {
return <div>Loading...</div>;
}
return (
<div className="user-profile">
<h1>{user.name}</h1>
<p>{user.email}</p>
</div>
);
};HUMAN
AI
React
const UserCard = ({ profile }) => {
if (!profile) return null; // Parent handles loading skeleton
return (
<div className="p-4 border rounded shadow-sm">
<h3 className="font-bold">{profile.displayName}</h3>
<span className="text-sm text-gray-500">{profile.role}</span>
</div>
);
};HUMAN
AI
SQL
SELECT * FROM users WHERE age > 18 AND status = 'active';HUMAN
AI
SQL
SELECT id, email, created_at
FROM users
WHERE age >= 21 -- legal drinking age in US
AND status_id = 1; -- 1 is activeHUMAN
AI
CSS
.center-container {
display: flex;
justify-content: center;
align-items: center;
width: 100%;
height: 100vh;
}HUMAN
AI
CSS
.hero {
display: grid;
place-items: center;
min-height: 100dvh; /* dynamic viewport height */
}HUMAN
AI
←
AI Vibe→
Human Vibe