Spaces:
Running
Running
Download index.html from HYPERMARK/quantumcode-nexus: direct link, hf CLI and curl.
- Browser
- Download file 25.4 kB
-
https://huggingface.co/spaces/HYPERMARK/quantumcode-nexus/resolve/main/index.html
- Command line
-
hf download hf://spaces/HYPERMARK/quantumcode-nexus/index.html
-
curl -L -o index.html https://huggingface.co/spaces/HYPERMARK/quantumcode-nexus/resolve/main/index.html
25.4 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>QuantumCode Nexus</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.globe.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/qiskit.js@latest/dist/qiskit.js"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css"> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/theme/dracula.min.css"> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/javascript/javascript.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/country-flag-emoji-json@1.0.2/dist/by-code.json"></script> | |
| <style> | |
| @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap'); | |
| :root { | |
| --primary: #7c3aed; | |
| --secondary: #10b981; | |
| --accent: #ec4899; | |
| --dark: #0f172a; | |
| --light: #f8fafc; | |
| } | |
| body { | |
| font-family: 'Space Grotesk', sans-serif; | |
| background-color: var(--dark); | |
| color: var(--light); | |
| overflow-x: hidden; | |
| } | |
| .gradient-text { | |
| background: linear-gradient(90deg, var(--primary), var(--accent)); | |
| -webkit-background-clip: text; | |
| background-clip: text; | |
| color: transparent; | |
| } | |
| .code-editor { | |
| font-family: 'Fira Code', monospace; | |
| background: rgba(15, 23, 42, 0.8); | |
| border: 1px solid rgba(124, 58, 237, 0.3); | |
| border-radius: 0.5rem; | |
| } | |
| .quantum-particle { | |
| position: absolute; | |
| width: 4px; | |
| height: 4px; | |
| border-radius: 50%; | |
| background: var(--primary); | |
| opacity: 0.6; | |
| animation: float 15s infinite linear; | |
| } | |
| @keyframes float { | |
| 0% { transform: translate(0, 0); opacity: 0; } | |
| 10% { opacity: 0.6; } | |
| 90% { opacity: 0.6; } | |
| 100% { transform: translate(var(--tx, 100px), var(--ty, -100px)); opacity: 0; } | |
| } | |
| .output-line { | |
| border-left: 3px solid; | |
| padding-left: 1rem; | |
| margin-bottom: 0.5rem; | |
| } | |
| .output-line.info { border-color: #3b82f6; color: #bfdbfe; } | |
| .output-line.success { border-color: var(--secondary); color: #a7f3d0; } | |
| .output-line.warning { border-color: #f59e0b; color: #fef08a; } | |
| .output-line.error { border-color: #ef4444; color: #fecaca; } | |
| .nav-item { | |
| transition: all 0.2s ease; | |
| border-left: 3px solid transparent; | |
| } | |
| .nav-item:hover, .nav-item.active { | |
| background: rgba(124, 58, 237, 0.1); | |
| border-left-color: var(--primary); | |
| } | |
| .quantum-card { | |
| background: rgba(15, 23, 42, 0.6); | |
| border: 1px solid rgba(124, 58, 237, 0.3); | |
| transition: all 0.3s ease; | |
| } | |
| .quantum-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.3); | |
| } | |
| </style> | |
| </head> | |
| <body class="min-h-screen"> | |
| <div id="quantum-bg" class="fixed inset-0 -z-10"></div> | |
| <!-- Particles --> | |
| <div id="particles"></div> | |
| <div class="container mx-auto px-4 py-8"> | |
| <!-- Header --> | |
| <header class="flex justify-between items-center mb-12"> | |
| <div class="flex items-center space-x-2"> | |
| <div class="w-10 h-10 rounded-full bg-gradient-to-br from-purple-600 to-pink-500 flex items-center justify-center"> | |
| <span class="text-white font-bold text-xl">α</span> | |
| </div> | |
| <h1 class="text-2xl font-bold gradient-text">QuantumCode Nexus</h1> | |
| </div> | |
| <nav class="hidden md:flex space-x-6"> | |
| <a href="#" class="text-gray-300 hover:text-white transition">Docs</a> | |
| <a href="#" class="text-gray-300 hover:text-white transition">Examples</a> | |
| <a href="#" class="text-gray-300 hover:text-white transition">Community</a> | |
| <a href="#" class="text-gray-300 hover:text-white transition">Blog</a> | |
| </nav> | |
| <button class="md:hidden text-gray-300"> | |
| <i data-feather="menu"></i> | |
| </button> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="grid grid-cols-1 lg:grid-cols-3 gap-8"> | |
| <!-- Sidebar --> | |
| <aside class="lg:col-span-1 bg-gray-900 bg-opacity-50 rounded-xl p-6 backdrop-blur-lg border border-gray-800"> | |
| <div class="mb-8"> | |
| <h2 class="text-xl font-semibold mb-4 gradient-text">Quantum Playground</h2> | |
| <p class="text-gray-400">Experiment with quantum computing concepts in a global collaborative environment.</p> | |
| </div> | |
| <div class="space-y-1 mb-8"> | |
| <h3 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-2">EXPLORE</h3> | |
| <a href="#" class="nav-item active block px-4 py-2 text-white"> | |
| <div class="flex items-center space-x-3"> | |
| <i data-feather="cpu"></i> | |
| <span>Quantum Simulator</span> | |
| </div> | |
| </a> | |
| <a href="#" class="nav-item block px-4 py-2 text-gray-400 hover:text-white"> | |
| <div class="flex items-center space-x-3"> | |
| <i data-feather="globe"></i> | |
| <span>Global Network</span> | |
| </div> | |
| </a> | |
| <a href="#" class="nav-item block px-4 py-2 text-gray-400 hover:text-white"> | |
| <div class="flex items-center space-x-3"> | |
| <i data-feather="database"></i> | |
| <span>Quantum Database</span> | |
| </div> | |
| </a> | |
| <a href="#" class="nav-item block px-4 py-2 text-gray-400 hover:text-white"> | |
| <div class="flex items-center space-x-3"> | |
| <i data-feather="users"></i> | |
| <span>Collaborate</span> | |
| </div> | |
| </a> | |
| </div> | |
| <div class="space-y-1 mb-8"> | |
| <h3 class="text-sm font-semibold text-gray-500 uppercase tracking-wider mb-2">LEARN</h3> | |
| <a href="#" class="nav-item block px-4 py-2 text-gray-400 hover:text-white"> | |
| <div class="flex items-center space-x-3"> | |
| <i data-feather="book"></i> | |
| <span>Tutorials</span> | |
| </div> | |
| </a> | |
| <a href="#" class="nav-item block px-4 py-2 text-gray-400 hover:text-white"> | |
| <div class="flex items-center space-x-3"> | |
| <i data-feather="code"></i> | |
| <span>API Reference</span> | |
| </div> | |
| </a> | |
| <a href="#" class="nav-item block px-4 py-2 text-gray-400 hover:text-white"> | |
| <div class="flex items-center space-x-3"> | |
| <i data-feather="video"></i> | |
| <span>Video Guides</span> | |
| </div> | |
| </a> | |
| </div> | |
| <div class="p-4 bg-gray-800 rounded-lg"> | |
| <h3 class="text-sm font-semibold mb-2 text-gray-300">Global Stats</h3> | |
| <div class="space-y-3"> | |
| <div class="flex justify-between items-center"> | |
| <span class="text-gray-400">Developers Online</span> | |
| <span class="font-medium">12,487</span> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <span class="text-gray-400">Countries</span> | |
| <span class="font-medium">89</span> | |
| </div> | |
| <div class="flex justify-between items-center"> | |
| <span class="text-gray-400">Quantum Circuits</span> | |
| <span class="font-medium">42,156</span> | |
| </div> | |
| </div> | |
| </div> | |
| </aside> | |
| <!-- Editor Section --> | |
| <section class="lg:col-span-2 space-y-8"> | |
| <div class="quantum-card rounded-xl p-6"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <h2 class="text-xl font-semibold gradient-text">Quantum Editor</h2> | |
| <div class="flex space-x-2"> | |
| <button class="px-4 py-2 bg-purple-600 hover:bg-purple-700 rounded-lg text-white flex items-center space-x-2"> | |
| <i data-feather="play"></i> | |
| <span>Run</span> | |
| </button> | |
| <button class="px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg text-white flex items-center space-x-2"> | |
| <i data-feather="share-2"></i> | |
| <span>Share</span> | |
| </button> | |
| </div> | |
| </div> | |
| <div class="code-editor p-4 mb-6"> | |
| <textarea id="quantum-code" class="w-full h-64 bg-transparent outline-none resize-none text-gray-300 font-mono text-sm" spellcheck="false">// Quantum Hello World in JavaScript-like syntax | |
| function quantumHello() { | |
| // Create superposition of states | |
| const states = ['|0⟩', '|1⟩', '|+⟩', '|-⟩']; | |
| const qubit = quantum.superposition(states); | |
| // Apply quantum gates | |
| quantum.hadamard(qubit); | |
| quantum.phase(qubit, Math.PI/4); | |
| // Measure the qubit | |
| const result = quantum.measure(qubit); | |
| // Entangle with other qubits globally | |
| quantum.entangle('global-network', qubit); | |
| console.log(`Measured state: ${result}`); | |
| return result; | |
| } | |
| // Execute the quantum circuit | |
| quantumHello();</textarea> | |
| </div> | |
| <div class="flex items-center space-x-4 text-sm text-gray-400"> | |
| <div class="flex items-center space-x-1"> | |
| <i data-feather="cpu" class="w-4 h-4"></i> | |
| <span>Quantum Simulator v2.4.1</span> | |
| </div> | |
| <div class="flex items-center space-x-1"> | |
| <i data-feather="globe" class="w-4 h-4"></i> | |
| <span>Connected to 89 nodes</span> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Output Section --> | |
| <div class="quantum-card rounded-xl p-6"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h2 class="text-xl font-semibold gradient-text">Quantum Output</h2> | |
| <button class="px-3 py-1 bg-gray-700 hover:bg-gray-600 rounded-lg text-white flex items-center space-x-1 text-sm"> | |
| <i data-feather="trash-2" class="w-4 h-4"></i> | |
| <span>Clear</span> | |
| </button> | |
| </div> | |
| <div class="bg-gray-900 rounded-lg p-4 h-48 overflow-y-auto"> | |
| <div class="output-line info">QuantumCode Nexus v2.4.1 initialized</div> | |
| <div class="output-line success">Quantum simulator ready</div> | |
| <div class="output-line info">Type Ctrl+Enter or click Run to execute</div> | |
| </div> | |
| </div> | |
| <!-- Global Network --> | |
| <div class="quantum-card rounded-xl p-6"> | |
| <h2 class="text-xl font-semibold gradient-text mb-6">Global Quantum Network</h2> | |
| <div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4"> | |
| <!-- These will be populated by JavaScript --> | |
| <div id="country-node-us" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> | |
| <div class="text-3xl mb-2">🇺🇸</div> | |
| <div class="font-medium">United States</div> | |
| <div class="text-sm text-gray-400"><span class="node-count">2,145</span> nodes</div> | |
| </div> | |
| <div id="country-node-in" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> | |
| <div class="text-3xl mb-2">🇮🇳</div> | |
| <div class="font-medium">India</div> | |
| <div class="text-sm text-gray-400"><span class="node-count">1,876</span> nodes</div> | |
| </div> | |
| <div id="country-node-de" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> | |
| <div class="text-3xl mb-2">🇩🇪</div> | |
| <div class="font-medium">Germany</div> | |
| <div class="text-sm text-gray-400"><span class="node-count">943</span> nodes</div> | |
| </div> | |
| <div id="country-node-br" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> | |
| <div class="text-3xl mb-2">🇧🇷</div> | |
| <div class="font-medium">Brazil</div> | |
| <div class="text-sm text-gray-400"><span class="node-count">782</span> nodes</div> | |
| </div> | |
| <div id="country-node-jp" class="bg-gray-800 rounded-lg p-4 text-center hover:bg-gray-700 transition"> | |
| <div class="text-3xl mb-2">🇯🇵</div> | |
| <div class="font-medium">Japan</div> | |
| <div class="text-sm text-gray-400"><span class="node-count">654</span> nodes</div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="mt-16 pt-8 border-t border-gray-800"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <div class="flex items-center space-x-2 mb-4 md:mb-0"> | |
| <div class="w-8 h-8 rounded-full bg-gradient-to-br from-purple-600 to-pink-500 flex items-center justify-center"> | |
| <span class="text-white font-bold text-sm">α</span> | |
| </div> | |
| <span class="font-medium">QuantumCode Nexus</span> | |
| </div> | |
| <div class="flex space-x-6"> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i data-feather="github"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i data-feather="twitter"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i data-feather="discord"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i data-feather="youtube"></i> | |
| </a> | |
| </div> | |
| </div> | |
| <div class="mt-8 text-center text-gray-500 text-sm"> | |
| <p>© 2023 QuantumCode Nexus. All qubits reserved.</p> | |
| </div> | |
| </footer> | |
| </div> | |
| <script> | |
| // Initialize Vanta.js globe | |
| VANTA.GLOBE({ | |
| el: "#quantum-bg", | |
| mouseControls: true, | |
| touchControls: true, | |
| gyroControls: false, | |
| minHeight: 200.00, | |
| minWidth: 200.00, | |
| scale: 1.00, | |
| scaleMobile: 1.00, | |
| color: 0x7c3aed, | |
| backgroundColor: 0x0f172a, | |
| size: 1.00 | |
| }); | |
| // Create floating particles | |
| function createParticles() { | |
| const container = document.getElementById('particles'); | |
| for (let i = 0; i < 30; i++) { | |
| const particle = document.createElement('div'); | |
| particle.className = 'quantum-particle'; | |
| // Random position | |
| const x = Math.random() * 100; | |
| const y = Math.random() * 100; | |
| particle.style.left = `${x}%`; | |
| particle.style.top = `${y}%`; | |
| // Random animation | |
| const tx = (Math.random() - 0.5) * 200; | |
| const ty = (Math.random() - 0.5) * 200; | |
| particle.style.setProperty('--tx', `${tx}px`); | |
| particle.style.setProperty('--ty', `${ty}px`); | |
| particle.style.animationDuration = `${10 + Math.random() * 20}s`; | |
| particle.style.animationDelay = `${Math.random() * 5}s`; | |
| // Random color | |
| const colors = ['#7c3aed', '#ec4899', '#10b981', '#3b82f6']; | |
| particle.style.background = colors[Math.floor(Math.random() * colors.length)]; | |
| container.appendChild(particle); | |
| } | |
| } | |
| // Quantum Circuit Execution API | |
| async function executeQuantumCircuit(code) { | |
| try { | |
| const output = []; | |
| // Mock quantum operations | |
| const mockQuantum = { | |
| superposition: (states) => { | |
| output.push(`Created superposition of ${states.length} states`); | |
| return { | |
| id: Math.random().toString(36).substring(7), | |
| states: states | |
| }; | |
| }, | |
| hadamard: (qubit) => { | |
| output.push(`Applied Hadamard gate to qubit ${qubit.id}`); | |
| }, | |
| phase: (qubit, angle) => { | |
| output.push(`Applied phase shift of ${angle} radians to qubit ${qubit.id}`); | |
| }, | |
| measure: (qubit) => { | |
| const result = qubit.states[Math.floor(Math.random() * qubit.states.length)]; | |
| output.push(`Measured qubit ${qubit.id} → ${result}`); | |
| return result; | |
| }, | |
| entangle: (network, qubit) => { | |
| output.push(`Entangled qubit ${qubit.id} with ${network}`); | |
| } | |
| }; | |
| // Create a safe execution context | |
| const context = { | |
| quantum: mockQuantum, | |
| console: { | |
| log: (msg) => output.push(`Console: ${msg}`) | |
| } | |
| }; | |
| // Execute the code safely | |
| new Function('quantum', 'console', code)(context.quantum, context.console); | |
| return { | |
| output: output, | |
| executionTime: `${(Math.random() * 100 + 50).toFixed(2)}ms` | |
| }; | |
| } catch (error) { | |
| console.error("Execution error:", error); | |
| return { | |
| error: `Runtime Error: ${error.message}`, | |
| line: error.stack.split('\n')[1] | |
| }; | |
| } | |
| } | |
| // Add syntax highlighting | |
| function setupEditor() { | |
| const textarea = document.getElementById('quantum-code'); | |
| const editor = CodeMirror.fromTextArea(textarea, { | |
| mode: 'javascript', | |
| theme: 'dracula', | |
| lineNumbers: true, | |
| indentUnit: 2, | |
| tabSize: 2, | |
| extraKeys: { | |
| 'Ctrl-Enter': simulateExecution | |
| } | |
| }); | |
| // Store editor instance | |
| window.quantumEditor = editor; | |
| } | |
| // Get online users count | |
| async function getOnlineUsers() { | |
| const response = await axios.get('https://quantum-network.glitch.me/stats'); | |
| return response.data; | |
| } | |
| // Simulate quantum execution | |
| async function simulateExecution() { | |
| const output = document.querySelector('.bg-gray-900'); | |
| const code = document.querySelector('textarea').value; | |
| // Clear previous output except initial messages | |
| while (output.children.length > 5) { | |
| output.removeChild(output.lastChild); | |
| } | |
| // Add loading state | |
| const loadingLine = document.createElement('div'); | |
| loadingLine.className = 'output-line info'; | |
| loadingLine.textContent = 'Executing quantum circuit...'; | |
| output.appendChild(loadingLine); | |
| try { | |
| const result = await executeQuantumCircuit(code); | |
| if (result.error) { | |
| const errorLine = document.createElement('div'); | |
| errorLine.className = 'output-line error'; | |
| errorLine.textContent = result.error; | |
| output.appendChild(errorLine); | |
| } else { | |
| const greetingLine = document.createElement('div'); | |
| greetingLine.className = 'output-line success'; | |
| greetingLine.textContent = `Quantum Greeting: ${result.greeting}`; | |
| output.appendChild(greetingLine); | |
| const countryLine = document.createElement('div'); | |
| countryLine.className = 'output-line success'; | |
| countryLine.textContent = `Data entangled with ${result.country} (${result.flag})`; | |
| output.appendChild(countryLine); | |
| } | |
| // Update network stats | |
| const stats = await getOnlineUsers(); | |
| document.querySelectorAll('.font-medium')[0].textContent = stats.onlineUsers.toLocaleString(); | |
| document.querySelectorAll('.font-medium')[1].textContent = stats.countries; | |
| document.querySelectorAll('.font-medium')[2].textContent = stats.circuits.toLocaleString(); | |
| } catch (error) { | |
| const errorLine = document.createElement('div'); | |
| errorLine.className = 'output-line error'; | |
| errorLine.textContent = `Quantum error: ${error.message}`; | |
| output.appendChild(errorLine); | |
| } | |
| // Scroll to bottom | |
| output.scrollTop = output.scrollHeight; | |
| } | |
| // Initialize | |
| document.addEventListener('DOMContentLoaded', async () => { | |
| feather.replace(); | |
| createParticles(); | |
| setupEditor(); | |
| // Run button click handler | |
| document.querySelector('.bg-purple-600').addEventListener('click', simulateExecution); | |
| // Add keyboard shortcut | |
| document.addEventListener('keydown', (e) => { | |
| if (e.ctrlKey && e.key === 'Enter') { | |
| simulateExecution(); | |
| } | |
| }); | |
| // Mobile menu toggle | |
| document.querySelector('.md\\:hidden').addEventListener('click', () => { | |
| document.querySelector('aside').classList.toggle('hidden'); | |
| }); | |
| // Load initial stats | |
| try { | |
| const stats = await getOnlineUsers(); | |
| document.querySelectorAll('.font-medium')[0].textContent = stats.onlineUsers.toLocaleString(); | |
| document.querySelectorAll('.font-medium')[1].textContent = stats.countries; | |
| document.querySelectorAll('.font-medium')[2].textContent = stats.circuits.toLocaleString(); | |
| } catch (error) { | |
| console.error("Failed to load stats:", error); | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> | |