Skip to content

Instantly share code, notes, and snippets.

@alxarch
Created October 26, 2014 10:21
Show Gist options
  • Select an option

  • Save alxarch/bc3d799af59caa97ab8a to your computer and use it in GitHub Desktop.

Select an option

Save alxarch/bc3d799af59caa97ab8a to your computer and use it in GitHub Desktop.
Greek to greeklish for MySQL
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION `greeklish`(input text charset utf8) RETURNS text CHARSET utf8
BEGIN
DECLARE result text charset utf8 DEFAULT '';
DECLARE len INT(4) DEFAULT 0;
DECLARE pos INT(4) DEFAULT 1;
DECLARE letter VARCHAR(10) charset utf8;
SET input = LOWER(input);
SET len = CHAR_LENGTH(input);
SET input = REPLACE(input, "ου", 'u');
SET input = REPLACE(input, "ού", 'i');
SET input = REPLACE(input, "αι", 'e');
SET input = REPLACE(input, "αί", 'i');
SET input = REPLACE(input, "οί", 'i');
SET input = REPLACE(input, "υι", 'i');
SET input = REPLACE(input, "υί", 'i');
SET input = REPLACE(input, "οι", 'i');
SET input = REPLACE(input, "ει", 'i');
SET input = REPLACE(input, "εί", 'i');
SET input = REPLACE(input, "γκ", 'g');
SET input = REPLACE(input, "γγ", 'g');
SET input = REPLACE(input, "γυ", 'y');
SET input = REPLACE(input, "γι", 'y');
SET input = REPLACE(input, "ντ", 'd');
SET input = REPLACE(input, "μπ", 'b');
SET input = REPLACE(input, "αυ", 'af');
SET input = REPLACE(input, "αύ", 'af');
SET input = REPLACE(input, "ευ", 'ef');
SET input = REPLACE(input, "εύ", 'ef');
WHILE (pos <= len) DO
SET letter = SUBSTRING(input, pos, 1);
CASE TRUE
WHEN letter IN('α','ά') THEN SET letter = 'a';
WHEN letter IN('ε','έ') THEN SET letter = 'e';
WHEN letter IN('ο', 'ό', 'ω','ώ') THEN SET letter = 'o';
WHEN letter IN('ί','ι','ϊ','ΐ','η', 'ή', 'υ','ύ','ϋ','ΰ') THEN SET letter = 'i';
WHEN letter = 'β' THEN SET letter = 'b';
WHEN letter = 'γ' THEN SET letter = 'g';
WHEN letter = 'δ' THEN SET letter = 'd';
WHEN letter = 'ζ' THEN SET letter = 'z';
WHEN letter = 'θ' THEN SET letter = 'th';
WHEN letter = 'κ' THEN SET letter = 'k';
WHEN letter = 'λ' THEN SET letter = 'l';
WHEN letter = 'μ' THEN SET letter = 'm';
WHEN letter = 'ν' THEN SET letter = 'n';
WHEN letter = 'ξ' THEN SET letter = 'x';
WHEN letter = 'π' THEN SET letter = 'p';
WHEN letter = 'ρ' THEN SET letter = 'r';
WHEN letter IN('σ', 'ς') THEN SET letter = 's';
WHEN letter = 'τ' THEN SET letter = 't';
WHEN letter = 'φ' THEN SET letter = 'f';
WHEN letter = 'χ' THEN SET letter = 'ch';
WHEN letter = 'ψ' THEN SET letter = 'ps';
ELSE
SET letter = letter;
END CASE;
SET result = CONCAT(result, letter);
SET pos = pos + 1;
END WHILE;
RETURN result;
END$$
DELIMITER ;
@arjunchaudhry376-ui
Copy link

<title>💛 Surprise Question 💛</title> <style> body { margin: 0; font-family: 'Segoe UI', sans-serif; background: linear-gradient(135deg, #ff9a9e, #fad0c4); display: flex; justify-content: center; align-items: center; height: 100vh; overflow: hidden; color: #fff; text-align: center; position: relative; }
.container {
    background: rgba(0,0,0,0.5);
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    max-width: 400px;
    z-index: 10;
}

.emoji-step {
    font-size: 2rem;
    margin: 20px 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.question {
    font-size: 1.8rem;
    margin-top: 30px;
    display: none;
}

.buttons {
    margin-top: 20px;
    display: none;
}

.buttons button {
    background: #fff;
    color: #ff4081;
    border: none;
    padding: 12px 25px;
    margin: 10px;
    font-size: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

.buttons button:hover {
    transform: scale(1.1);
}

.surprise {
    font-size: 2rem;
    margin-top: 30px;
    display: none;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.heart {
    position: absolute;
    font-size: 2rem;
    animation: floatUp linear infinite;
    opacity: 0.8;
}

@keyframes floatUp {
    0% { transform: translateY(100vh) scale(1); opacity: 0.8; }
    100% { transform: translateY(-50px) scale(0.5); opacity: 0; }
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}
</style>

⏳ Loading Question…
💓 Checking Your Heart…
🔐 Unlocking Surprise…
📝 Preparing Final Question…
✨ Are you… my girlfriend? 💛😳
YES 💖 NO 😢
<script> // Step Animation let steps = ['step1','step2','step3','step4']; let delay = 1500; function showStep(i) { if(i < steps.length) { document.getElementById(steps[i]).style.opacity = 1; setTimeout(() => { showStep(i + 1); }, delay); } else { document.getElementById('question').style.display = 'block'; document.getElementById('buttons').style.display = 'block'; } } window.onload = () => showStep(0); // Reveal Answer with Hearts & Confetti function reveal(answer) { document.getElementById('buttons').style.display = 'none'; let surpriseText = answer === 'YES' ? "💖 Yay! You’re mine! 💖" : "😢 Oh… maybe next time!"; document.getElementById('surprise').textContent = surpriseText; document.getElementById('surprise').style.display = 'block'; createHearts(20); startConfetti(); } // Floating Hearts function createHearts(count) { for(let i=0;iheart.remove(),5000); } } // Confetti Effect const canvas = document.getElementById('confetti'); const ctx = canvas.getContext('2d'); let W = canvas.width = window.innerWidth; let H = canvas.height = window.innerHeight; let confettiParticles = []; function ConfettiParticle(){ this.x = Math.random()*W; this.y = Math.random()*H- H; this.r = Math.random()*6+4; this.d = Math.random()*H; this.color = "hsl(" + Math.random()*360 + ", 100%, 50%)"; this.tilt = Math.random()*10 -10; this.tiltAngleIncremental = Math.random() * 0.07 + 0.05; this.tiltAngle = 0; } function initConfetti(){ confettiParticles = []; for(let i=0;i<150;i++){ confettiParticles.push(new ConfettiParticle()); } } function drawConfetti(){ ctx.clearRect(0,0,W,H); confettiParticles.forEach(p=>{ ctx.beginPath(); ctx.lineWidth = p.r/2; ctx.strokeStyle = p.color; ctx.moveTo(p.x + p.tilt + p.r/4, p.y); ctx.lineTo(p.x + p.tilt, p.y + p.tilt + p.r/4); ctx.stroke(); }); updateConfetti(); } function updateConfetti(){ confettiParticles.forEach(p=>{ p.tiltAngle += p.tiltAngleIncremental; p.y += (Math.cos(p.d) + 3 + p.r/2)/2; p.tilt = Math.sin(p.tiltAngle) * 15; if(p.y > H){ p.y = -10; p.x = Math.random()*W;} }); } let confettiInterval; function startConfetti(){ initConfetti(); confettiInterval = setInterval(drawConfetti, 20); setTimeout(()=>clearInterval(confettiInterval), 7000); } window.addEventListener('resize', ()=>{ W = canvas.width = window.innerWidth; H = canvas.height = window.innerHeight; }); </script>

@arjunchaudhry376-ui
Copy link

Generate gifr

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