Skip to content

Instantly share code, notes, and snippets.

@MacTanomsup
Created July 22, 2016 06:41
Show Gist options
  • Select an option

  • Save MacTanomsup/ce19661f56eb601db5d4870083f46aeb to your computer and use it in GitHub Desktop.

Select an option

Save MacTanomsup/ce19661f56eb601db5d4870083f46aeb to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Home Voice Control</title>
<link rel="stylesheet" href="mystyle.css">
</head>
<body>
<center>
<a href="https://medium.com/@maccismyname">
<img src="logo.png"/>
</a>
</center>
<div class="container">
<br>
<center>
<h2 id="info_microphone">สวัสดี, วันนี้ต้องการให้ช่วยอะไร?</h2>
</center>
<br>
<center>
<button id="start_button" onclick="startButton(event)">
<img id="start_img" src="mic.gif" alt="Start"></button>
</center>
<br>
<div id="results">
<p>คำสั่ง : </p>
<p id="final_span" class="final"></p>
<br>
<p>ผลลัพธ์ : </p>
<p id="final_result"></p>
</div>
<p>ลองพูดคำสั่งต่อไปนี้สิ : สวัสดี, สบายดีไหม, เปิดไฟหน้าบ้าน, ปิดไฟทั้งหมด </p>
</div>
</body>
<script>
//Welcome sound !!
var msg = new SpeechSynthesisUtterance('สวัสดี, วันนี้ต้องการให้ช่วยอะไร?');
msg.lang = 'th-TH';
window.speechSynthesis.speak(msg);
var final_transcript = '';
var recognizing = false;
var ignore_onend;
if (!('webkitSpeechRecognition' in window)) {
//if don't have a webkitSpeechRecognition
} else {
var recognition = new webkitSpeechRecognition();
recognition.lang = "th-TH";
recognition.onstart = function() {
recognizing = true;
start_img.src = 'mic-animate.gif';
};
recognition.onresult = function(event) {
console.log(event)
var interim_transcript = '';
for (var i = event.resultIndex; i < event.results.length; ++i) {
if (event.results[i].isFinal) {
final_transcript += event.results[i][0].transcript;
} else {
interim_transcript += event.results[i][0].transcript;
}
}
final_span.innerHTML = final_transcript;
speak(final_transcript);
}
}
function startButton(event) {
if (recognizing) {
recognition.stop();
return;
}
final_transcript = '';
recognition.start();
ignore_onend = false;
start_img.src = 'mic-slash.gif';
}
recognition.onend = function() {
recognizing = false;
if (ignore_onend) {
return;
}
start_img.src = 'mic.gif';
};
// ignore //
// var first_char = /\S/;
// function capitalize(s) {
// return s.replace(first_char, function(m) { return m.toUpperCase(); });
// }
//
// var two_line = /\n\n/g;
// var one_line = /\n/g;
// function linebreak(s) {
// return s.replace(two_line, '<p></p>').replace(one_line, '<br>');
// }
// ignore //
function speak(text) {
//Hardcode becuz it's a tutorial. Got it?
var msg_light = 'เปิดไฟหน้าบ้าน';
var turnoffAllLight = 'ปิดไฟทั้งหมด'
var whatsup = 'สบายดีไหม';
var sawasdee = 'สวัสดี';
//Text to speech
var speechSynthesis = new SpeechSynthesisUtterance();
speechSynthesis.voiceURI = 'native';
speechSynthesis.volume = 1; // 0 to 1
speechSynthesis.rate = 1; // 0.1 to 10
speechSynthesis.pitch = 2; //0 to 2
speechSynthesis.lang = 'th-TH';
var msg = '';
//Do whatever you want.
if(text.search(msg_light) != -1 || text.search(turnoffAllLight) != -1 ) {
msg = "ทำการ" + text + "เรียบร้อยแล้วค่ะ";
speechSynthesis.text = msg;
} else if(text.search(whatsup) != -1) {
msg = 'สบายดีค่ะ, แล้วคุณหล่ะคะ ';
speechSynthesis.text = msg;
} else if(text.search(sawasdee) != -1) {
msg = 'สวัสดีค่ะ หนีฮ่าว สบายดี ฮัลโหล';
speechSynthesis.text = msg;
} else {
msg = 'คำสั่งดังกล่าวยังไม่มีในฐานข้อมูลค่ะ';
speechSynthesis.text = msg;
}
window.speechSynthesis.speak(speechSynthesis);
final_result.innerHTML = msg;
}
</script>
</html>
@444benzs
Copy link

444benzs commented Jun 6, 2025

@ayush224558
Copy link

<title>SAPUI5 Walkthrough</title> <script id="sap-ui-bootstrap" src="/resources/sap-ui-core.js" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-modules="sap.m.library" data-sap-ui-compatVersion="edge" data-sap-ui-preload="async" > </script> <script> sap.ui.getCore().attachInit(function () { new sap.m.Text({ text : "SAPUI5 is loaded successfully!" }).placeAt("content"); }); </script>

@Peter123456789p
Copy link

Hs

@ousmane12345
Copy link

Bonjour

@whiskyydrumm
Copy link

Uploading 1000073119.jpg…

<script src="https://gist.github.com/MacTanomsup/ce19661f56eb601db5d4870083f46aeb.js"></script>

@whiskyydrumm
Copy link

1000073119

@whiskyydrumm
Copy link

<script src="https://gist.github.com/MacTanomsup/ce19661f56eb601db5d4870083f46aeb.js"></script>

@whiskyydrumm
Copy link

Uploading 1000073119.jpg…

@whiskyydrumm
Copy link

I want to log in again to the Instagram account

@whiskyydrumm
Copy link

I want to log in again to the Instagram account

@whiskyydrumm
Copy link

I want to log in again to the Instagram account
Uploading 1000073077.jpg…

@tuddandelion
Copy link

gate.unlock('Verity')
core.enter()
dream.open()

@raghuveer-rdtiz
Copy link

1000079888
Hey

@raghuveer-rdtiz
Copy link

Hey

@rgp555099-bot
Copy link

/game
├── engine.js // game logic
├── ui.js // rendering functions
├── events.js // event binding
└── index.js // main entry point<motion.button
whileHover={{ scale: 1.1, boxShadow: "0px 0px 15px rgba(0,0,0,0.2)" }}
whileTap={{ scale: 0.95 }}
className="px-6 py-3 rounded-2xl bg-gradient-to-r from-purple-500 to-pink-500 text-white font-semibold shadow-lg"

Play Game
</motion.button>

Copy link

ghost commented Aug 26, 2025

@musarratparween427-code

using UnityEngine;

public class GunGameManager : MonoBehaviour
{
public GameObject[] weapons; // list of weapons
private int currentWeaponIndex = 0;

void Start()
{
    EquipWeapon(currentWeaponIndex);
}

public void OnPlayerKill()
{
    currentWeaponIndex++;
    if (currentWeaponIndex < weapons.Length)
    {
        EquipWeapon(currentWeaponIndex);
    }
    else
    {
        Debug.Log("Player Won Gun Game!");
    }
}

void EquipWeapon(int index)
{
    for (int i = 0; i < weapons.Length; i++)
    {
        weapons[i].SetActive(i == index);
    }
}

}

@vijayxyz540-source
Copy link

<title>SAPUI5 Walkthrough</title> <script id="sap-ui-bootstrap" src="/resources/sap-ui-core.js" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-modules="sap.m.library" data-sap-ui-compatVersion="edge" data-sap-ui-preload="async" > </script> <script> sap.ui.getCore().attachInit(function () { new sap.m.Text({ text : "SAPUI5 is loaded successfully!" }).placeAt("content"); }); </script>

@chendabun980-coder
Copy link

<title>Menu Mart</title> <style> body { font-family: "Khmer OS Battambang", sans-serif; background: #f8f9fa; margin: 0; padding: 0; } header { background: #2c3e50; color: #fff; padding: 20px; text-align: center; } .menu-section { max-width: 800px; margin: 30px auto; background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); } h2 { border-bottom: 2px solid #ddd; padding-bottom: 8px; color: #2c3e50; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } th, td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; } th { background: #f1f1f1; } </style>

🛒 មីនុយម៉ាត

ស្វាគមន៍មកកាន់ម៉ាតរបស់យើង

🥤 ភេសជ្ជៈ

ឈ្មោះទំនិញតម្លៃ
Pepsi 330ml2,500៛
ទឹកក្រូច Minute Maid3,000៛

🍪 សម្រន់

ឈ្មោះទំនិញតម្លៃ
ស្ពៃ Lay’s4,000៛
Oreo5,000៛

🥩 សាច់

ឈ្មោះទំនិញតម្លៃ
សាច់មាន់ (១គីឡូ)12,000៛
សាច់គោ (១គីឡូ)25,000៛

@halobanhbaik-bit
Copy link

<!doctype html>

@halobanhbaik-bit
Copy link

Yes

@danielpittman570-creator

type

@Adeladlew-wq
Copy link

i am happy to be part of this!!!

@pajaknsm33-rgb
Copy link

Uploading asus-t-u-f-gaming-wallpaper-s0nf1cl2yvrdv5l7.jpg…

@sknoyon6765-cmyk
Copy link

নাইচ

@VICTORY-FX
Copy link

n index.html

@mdra5744-stack
Copy link

বাজারে একটা অদ্ভুত দোকান বসেছে। কেউ সবজি বিক্রি করছে, কেউ মাছ, আবার এক কোণে এক লোক সাপ আর ইঁদুর বিক্রি করছে। লোকজন অবাক হয়ে জিজ্ঞেস করছে—

– ভাই, সাপ আর ইঁদুর আবার কে কিনবে?
– আরে জনাব, সাপ কিনবে ওঝারা, আর ইঁদুর কিনবে সাপওয়ালারা!

চারপাশের মানুষ হেসে উঠল।
Uploading InShot_20250911_204926187.jpg…

@mdra5744-stack
Copy link

বাজারে একটা অদ্ভুত দোকান বসেছে। কেউ সবজি বিক্রি করছে, কেউ মাছ, আবার এক কোণে এক লোক সাপ আর ইঁদুর বিক্রি করছে। লোকজন অবাক হয়ে জিজ্ঞেস করছে—

– ভাই, সাপ আর ইঁদুর আবার কে কিনবে?
– আরে জনাব, সাপ কিনবে ওঝারা, আর ইঁদুর কিনবে সাপওয়ালারা!

চারপাশের মানুষ হেসে উঠল।

@to3251-beep
Copy link

<title>Mini Retro Bowl</title> <style> body { background: #222; color: #eee; font-family: 'Courier New', Courier, monospace; display: flex; flex-direction: column; align-items: center; padding: 20px; height: 100vh; margin: 0; } h1 { margin-bottom: 10px; } .game-container { background: #111; border: 2px solid #55ff55; border-radius: 8px; padding: 20px; width: 320px; text-align: center; } button { background: #55ff55; border: none; color: #111; padding: 12px 24px; font-size: 16px; margin: 10px; border-radius: 6px; cursor: pointer; transition: background 0.3s ease; } button:hover { background: #33cc33; } .status { margin: 15px 0; min-height: 60px; } .scoreboard { margin-top: 20px; font-size: 18px; } </style>

Mini Retro Bowl

Choose your play:
Run Pass
<div class="status" id="status">Make your first play!</div>

<div class="scoreboard">
  <div>Yards Gained: <span id="yards">0</span></div>
  <div>Score: <span id="score">0</span></div>
  <div>Down: <span id="down">1</span></div>
  <div>Distance to First Down: <span id="distance">10</span></div>
</div>
<script> const runBtn = document.getElementById('run-btn'); const passBtn = document.getElementById('pass-btn'); const statusDiv = document.getElementById('status'); const yardsSpan = document.getElementById('yards'); const scoreSpan = document.getElementById('score'); const downSpan = document.getElementById('down'); const distanceSpan = document.getElementById('distance'); let totalYards = 0; let score = 0; let down = 1; let distance = 10; let plays = 0; const maxPlays = 10; function playRun() { // Run plays are safer but shorter gains // 70% chance of success, 1-7 yards gained const success = Math.random() < 0.7; if(success) { const gained = Math.floor(Math.random() * 7) + 1; return gained; } else { return 0; // no gain or loss on fail } } function playPass() { // Pass plays riskier: 50% chance of success // Success: 3-15 yards, Fail: interception (game over) const success = Math.random() < 0.5; if(success) { const gained = Math.floor(Math.random() * 13) + 3; return gained; } else { return -1; // interception } } function updateDisplay() { yardsSpan.textContent = totalYards; scoreSpan.textContent = score; downSpan.textContent = down; distanceSpan.textContent = distance; } function resetGame() { totalYards = 0; score = 0; down = 1; distance = 10; plays = 0; statusDiv.textContent = 'Make your first play!'; updateDisplay(); } function endGame(message) { statusDiv.textContent = message + " Game Over! Your final score: " + score; runBtn.disabled = true; passBtn.disabled = true; } function play(playType) { if(plays >= maxPlays) { endGame("Max plays reached."); return; } let yardsGained; if(playType === 'run') { yardsGained = playRun(); } else { yardsGained = playPass(); if(yardsGained === -1) { endGame("Interception! You lost the ball."); return; } } plays++; if(yardsGained > 0) { statusDiv.textContent = `Good play! You gained ${yardsGained} yards.`; totalYards += yardsGained; distance -= yardsGained; if(distance <= 0) { // First down! down = 1; distance = 10; score += 7; // Touchdown bonus simplified statusDiv.textContent += " First down! Touchdown! +7 points!"; } else { down++; } } else { statusDiv.textContent = `No gain on the play.`; down++; } if(down > 4) { endGame("Turnover on downs."); return; } updateDisplay(); if(plays >= maxPlays) { endGame("Max plays reached."); } } runBtn.addEventListener('click', () => play('run')); passBtn.addEventListener('click', () => play('pass')); resetGame(); </script>

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