Skip to content

Instantly share code, notes, and snippets.

View shahid249's full-sized avatar
💭
I may be slow to respond.

SHAHID shahid249

💭
I may be slow to respond.
View GitHub Profile
@shahid249
shahid249 / coutrycode to Country-locale language.php
Created April 2, 2019 10:35
This array containg country and its languages code. Most of the Country language code hasbeen added, but some of them are missing.
<?php
$countries = array
(
'AF' => 'ps-AR',
'AX' => 'Aland Islands',
'AL' => 'sq-AL',
'DZ' => 'ar-DZ',
'AS' => 'American Samoa',
'AD' => 'Andorra',
@shahid249
shahid249 / dimmer_&_speed_controll.ino
Created May 18, 2018 08:15
DC, bulb dimmer & motor speed control using arduino with LCD.
// include the library code:
#include <LiquidCrystal.h> // use the library for Display
#include <IRremote.h> // use the library for IR
const int receiver = 10; // pin of IR receiver to Arduino
const int bulb = 9; // To bulb or whatever you connect.
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int fadeValue;
@shahid249
shahid249 / esp8266ledonoffarduino.ino
Last active April 11, 2020 18:20
This code turn on led with Esp8266 & Arduino through web
/*Code By SHAHID
Turn On LED via Web through ESP8266 with Arduino.
ESP8266 & ARDUINO HTML WEB SERVER.
*/
#include <SoftwareSerial.h>
#define DEBUG true
SoftwareSerial esp8266(2,3); // make RX Arduino line is pin 5, make TX Arduino line is pin 6.
int LED=12; //LED PIN
int itsONled[] = {0,0}; // LED STATUS ARRAY eg- ON or OFF at startup. each value represent ech led.
@shahid249
shahid249 / 1 index.php
Created March 26, 2018 15:19
The Simple Custom Translator For Website Using Cookie | PHP
<?php
$cookie_name = "language"; //Cookie Name
$default_language = "en-us"; //Set here the default language code
$available_langs = array('en-us','bn'); //The Language we support list
//This will activate when language request submitted by users.
if(isset($_POST['lang'])){
// check if the language is available in array
if(in_array($_POST['lang'], $available_langs))
{
@shahid249
shahid249 / index-demo-site.html
Created December 27, 2017 07:08
How to change css link on click (Dark theme mode and light mode)
<html>
<head>
<title>Host Two Template</title>
<link rel="stylesheet" type="text/css" title="light" href="light.css">
<link rel="alternate stylesheet" type="text/css" title="dark" href="dark.css">
</head>
<body>
<div><h1>Content</h1></div>
<div>
<a href="#" onclick="switch_style('light');return false;" name="theme" value="light Theme" id="light">Light</a>
@shahid249
shahid249 / autoclosein5sec.js
Created July 2, 2017 16:36
open url in new windows and close in 5 seconds automatically - Javascripts
// put url by replacing http://example.com
//HTML Code
//<a href="javascript:void" onclick="loadUrl('http://example.com')">url</a>
<script type="text/javascript">
function loadUrl(newLocation)
{
var win = window.open(newLocation, '4536453645', 'width=500,height=200,left=375,top=330'); //adjust height weidth of window
setTimeout(function(){win.close()}, 5000);//5000 defines time 5000 = 5 sec
return false;
@shahid249
shahid249 / find-specific-value.php
Last active June 26, 2017 18:15
This code find specific value or words in arrary - PHP
<?php
// This code find specific value or words in arrary
$array = array('unacceptword', 'unacceptword1', 'unacceptword2');
$array1 = array('noteligible1', 'noteligible2', 'noteligible3');
//here you can post your value by form method | '$_POST[username]'
$obtainvalue = 'noteligible1' ;//'$_POST[username]';
if (in_array($obtainvalue, $array) || in_array($obtainvalue, $array1)){echo 'Not Acceptable';}
else if (in_array($obtainvalue, $array) || in_array($obtainvalue, $array1)){echo 'Not Eligible';}
?>
<!-- Your Form Data -->
@shahid249
shahid249 / random-uniqueid.php
Created June 25, 2017 07:08
Random Unique ID Generator in PHP
<?php
// with prefix
$uniqueid = uniqid('prefixhere_');
echo $uniqueid;
/* prints
prefixhere_594f60936a7e9
*/
// with more entropy
$uniqueid_2 = uniqid('',true);
@shahid249
shahid249 / countdown-timer.html
Last active June 26, 2017 18:15
This code show cowntdown timer clock - JavaScript
<!-- This display the countdown timer clock in an element -->
<p id="timer"></p>
<script>
//Put here the time and date when it will stop ("Sep 17, 2020 15:37:25")
var countdowndate = new Date("Sep 17, 2020 15:37:25").getTime();
var x = setInterval(function() {
var now = new Date().getTime();
var timecal = countdowndate - now;
var days = Math.floor(timecal/(1000*60*60*24));