Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Blogger & Coder

Sarmad Gardezi SarmadGardezi

👨‍💻
Blogger & Coder
View GitHub Profile
View Social Media Apps Chat Widget.js
<script type="text/javascript">
(function () {
var options = {
facebook: "874618785985682", // Facebook page ID
whatsapp: "03001234567", // WhatsApp number
viber: "sarmadgardezi", // Viber number
snapchat: "sarmadgardezi", // Snapchat username
line: "03001234567", // Line QR code URL
telegram: "sarmadgardezi", // Telegram bot username
vkontakte: "sarmadgardezi", // VKontakte page name
View Facebook Chat Plugin
// Script by Sarmad Gardezi sarmadgardezi.com
<script type="text/javascript">
(function () {
var options = {
facebook: "874618785985682", // Facebook page ID
whatsapp: "03001234567", // WhatsApp number
viber: "sarmadgardezi", // Viber number
snapchat: "sarmadgardezi", // Snapchat username
line: "03001234567", // Line QR code URL
telegram: "sarmadgardezi", // Telegram bot username
@SarmadGardezi
SarmadGardezi / Meta Tags for HTML Website
Created Oct 11, 2017
I'm sharing some of the best SEO meta tags for Static & HTML Website
View Meta Tags for HTML Website
<meta charset="utf-8"> <!-- set character encoding for the document -->
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<!-- Allows control over where resources are loaded from -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
<!-- Place as early in the document as possible -->
<!-- Only applies to content below this tag -->
@SarmadGardezi
SarmadGardezi / HTML5 Speech Search Supported Languages list
Created Oct 2, 2017
HTML5 Speech Search Supported Languages list Google Script by Sarmad Gardezi
View HTML5 Speech Search Supported Languages list
<option value="af-ZA">Afrikaans</option>
<option value="id-ID">Bahasa Indonesia</option>
<option value="ms-MY">Bahasa Melayu</option>
<option value="ca-ES">Català </option>
<option value="cs-CZ">Čeština</option>
<option value="da-DK">Dansk</option>
<option value="de-DE">Deutsch</option>
<optgroup label="English">
<option value="en-AU">Australia</option>
<option value="en-CA">Canada</option>
@SarmadGardezi
SarmadGardezi / Disable Enter key on a Form using JavaScript
Created Oct 1, 2017
How to disable Enter key on a form using JavaScript by Sarmad Gardezi
View Disable Enter key on a Form using JavaScript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Disable Enter key using JavaScript</title>
<script type="text/javascript">
function keypressAction(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
if (evt.keyCode == 13) {return false;}
}
@SarmadGardezi
SarmadGardezi / Image upload Imgur API JavaScript
Created Sep 24, 2017
Image Uploader with Imgur API and JavaScript
View Image upload Imgur API JavaScript
/*
--------------------------------
imgur Upload
--------------------------------
+ http://sarmadgardezi.com/blog/code/1522-image-uploader-with-imgur-api-and-javascript/
+ version 1.1
+ Copyright 2017 Sarmad Gardezi
+ Licensed under the MIT license
+ Documentation: http://sarmadgardezi.com/?p=1522
*/
@SarmadGardezi
SarmadGardezi / youtubeaudio
Created Aug 10, 2017
How to Embed YouTube video as an Audio Player
View youtubeaudio
/*
YouTube Audio Embed
--------------------
Author: Sarmad gardezi
Web: http://sarmadgardezi.com/?p=1000
*/
function onYouTubeIframeAPIReady(){var e=document.getElementById("youtube-audio"),t=document.createElement("img");t.setAttribute("id","youtube-icon"),t.style.cssText="cursor:pointer;cursor:hand",e.appendChild(t);var a=document.createElement("div");a.setAttribute("id","youtube-player"),e.appendChild(a);var o=function(e){var a=e?"IDzX9gL.png":"quyUPXN.png";t.setAttribute("src","https://i.imgur.com/"+a)};e.onclick=function(){r.getPlayerState()===YT.PlayerState.PLAYING||r.getPlayerState()===YT.PlayerState.BUFFERING?(r.pauseVideo(),o(!1)):(r.playVideo(),o(!0))};var r=new YT.Player("youtube-player",{height:"0",width:"0",videoId:e.dataset.video,playerVars:{autoplay:e.dataset.autoplay,loop:e.dataset.loop},events:{onReady:function(e){r.setPlaybackQuality("small"),o(r.getPlayerState()!==YT.PlayerState.CUED)},onStateChange:function(e){e.data===YT.PlayerState.ENDED&&o(!1)}}})}