Skip to content

Instantly share code, notes, and snippets.

View raihan-uddin's full-sized avatar
🎯
Focusing

Md. Raihan Uddin raihan-uddin

🎯
Focusing
View GitHub Profile
@raihan-uddin
raihan-uddin / Unzip zip files
Created March 14, 2020 09:43 — forked from vrushank-snippets/Unzip zip files
PHP : Unzip zip files
function unzip_file($file, $destination){
// create object
$zip = new ZipArchive() ;
// open archive
if ($zip->open($file) !== TRUE) {
die (’Could not open archive’);
}
// extract contents to destination directory
$zip->extractTo($destination);
// close archive
@raihan-uddin
raihan-uddin / Detect location by IP
Created March 14, 2020 09:43 — forked from vrushank-snippets/Detect location by IP
PHP : Detect location by IP
function detect_city($ip) {
$default = 'UNKNOWN';
if (!is_string($ip) || strlen($ip) < 1 || $ip == '127.0.0.1' || $ip == 'localhost')
$ip = '8.8.8.8';
$curlopt_useragent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)';
$url = 'http://ipinfodb.com/ip_locator.php?ip=' . urlencode($ip);
function generatePassword($length=9, $strength=0) {
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength >= 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength >= 2) {
$vowels .= "AEUY";
}
if ($strength >= 4) {
//$months = [1 => 'Final Sale', 2 => 'Quotation'];
$months = array(1 => 'Jan.', 2 => 'Feb.', 3 => 'Mar.', 4 => 'Apr.', 5 => 'May', 6 => 'Jun.', 7 => 'Jul.', 8 => 'Aug.', 9 => 'Sep.', 10 => 'Oct.', 11 => 'Nov.', 12 => 'Dec.');
echo $form->dropDownList($model, 'month', $months, array('prompt' => 'Select'));
/* year for loop*/
$year = array();
for ($i=0; $i < 10; $i++){
$y = 2020+$i;
$year[$y] = $y;
@raihan-uddin
raihan-uddin / digital-clock.php
Created April 19, 2020 04:10
Digital Clock
<style type="text/css">
/* Google font */
@import url('https://fonts.googleapis.com/css?family=Orbitron');
#digit_clock_time {
font-family: 'Work Sans', sans-serif;
color: #66ff99;
font-size: 35px;
text-align: center;
padding-top: 20px;
<style type="text/css">@import url("https://fonts.googleapis.com/css?family=Orbitron");
.alarm-clock {
position: relative;
padding: 10px;
border-radius: 10px;
background-color: tan;
}
.alarm-clock .date {
@raihan-uddin
raihan-uddin / yii1-rights-superadmin-permission
Created May 11, 2020 06:03
yii1-rights-superadmin-permission
INSERT INTO `AuthAssignment` (`itemname`, `userid`, `bizrule`, `data`) VALUES ('Admin', '1', NULL, 'N');
INSERT INTO `AuthItem` (`name`, `type`, `description`, `bizrule`, `data`) VALUES ('Admin', 0, 'Admin', NULL, 'N;');
@raihan-uddin
raihan-uddin / jquery file upload
Created June 8, 2020 07:04
jquery file upload
jQuery(document).ready(function ($) {
$("#btnPurchase").click(function (event) {
event.preventDefault(); // stopping submitting
var formData = new FormData($('form')[0]);
var data = $("#Purchaseasset").serializeArray();
var url = $("#Purchaseasset").attr('action');
$.ajax({
url: url,
type: 'post',
data: formData,
@raihan-uddin
raihan-uddin / simple-html-menu.html
Created June 22, 2020 16:49
html, css, navigation
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.main {
width: 100%;
background: #eee;
}
@raihan-uddin
raihan-uddin / calculator.py
Created September 28, 2020 09:50
PYTHON CONSOLE CALCULATOR
"""
Functions available are:
--------------------------------------------
+ : addition
- : subtraction
* : multiplication
/ : division
% : percentage
"""
import sys