Skip to content

Instantly share code, notes, and snippets.

@artpar
Created August 15, 2025 12:34
Show Gist options
  • Select an option

  • Save artpar/e2bf5609d7c112eb557a192cb42194f4 to your computer and use it in GitHub Desktop.

Select an option

Save artpar/e2bf5609d7c112eb557a192cb42194f4 to your computer and use it in GitHub Desktop.
Random tech content with code snippets and facts

Random Tech Thoughts

Here are some random thoughts and code snippets:

JavaScript Array Shuffle

function shuffleArray(array) {
    for (let i = array.length - 1; i > 0; i--) {
        const j = Math.floor(Math.random() * (i + 1));
        [array[i], array[j]] = [array[j], array[i]];
    }
    return array;
}

const colors = ['red', 'blue', 'green', 'yellow', 'purple'];
console.log(shuffleArray(colors));

Random Facts

  • The first computer bug was an actual bug (a moth) found in a Harvard Mark II computer in 1947
  • Python was named after Monty Python's Flying Circus, not the snake
  • The term "debugging" was coined by Admiral Grace Hopper
  • There are more possible games of chess than atoms in the observable universe

CSS Gradient Generator

.random-gradient {
    background: linear-gradient(
        45deg,
        #ff6b6b,
        #4ecdc4,
        #45b7d1,
        #96ceb4,
        #ffeaa7
    );
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

Random Quote

"The best way to predict the future is to invent it." - Alan Kay

Binary Tree in Python

class TreeNode:
    def __init__(self, val=0, left=None, right=None):
        self.val = val
        self.left = left
        self.right = right

def inorder_traversal(root):
    if not root:
        return []
    return inorder_traversal(root.left) + [root.val] + inorder_traversal(root.right)

Random Numbers

  • Lucky number: 42
  • Random seed: 1337
  • Fibonacci: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55

Generated on: August 15, 2025 Random ID: RND-2025-0815-TECH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment