Skip to content

Instantly share code, notes, and snippets.

View raazon's full-sized avatar
❤️
Eat - Sleep - Code

Razon Komar Pal raazon

❤️
Eat - Sleep - Code
View GitHub Profile
@raazon
raazon / copy-file.php
Last active September 3, 2021 15:46
copy file one server to another using php
<?php
/*
* REF: https://shellcreeper.com/move-files-server-to-server-using-simple-php/
*/
// Insert this file on server and go to the path from browser.
set_time_limit(0); // Unlimited max execution time
/* Source File URL */
$remote_file_url = 'http://origin-server-url/files.zip';
@raazon
raazon / async-script-load.js
Created December 17, 2019 12:10
Load scripts asynchronously
// If you user jQuery: https://api.jquery.com/jQuery.getScript/
// $.getScript(url, successCallback)
$.getScript( "ajax/test.js", function( data, textStatus, jqxhr ) {
console.log( data ); // Data returned
console.log( textStatus ); // Success
console.log( jqxhr.status ); // 200
console.log( "Load was performed." );
});
// Handling Errors
@raazon
raazon / google-map.html
Created December 3, 2019 07:47
Google map multiple marker with auto center and zoom
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Multiple Google Map Marker</title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key="></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="mapmarker.jquery.js"></script>
@raazon
raazon / google-map-clusterer.html
Created December 3, 2019 07:46
Google map clusterer multiple marker with auto center and zoom
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Marker Clustering</title>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
@raazon
raazon / generate-random-string.html
Created December 1, 2019 06:33
Generate random string/characters in JavaScript
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
function generateRandomString(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@!#';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
@raazon
raazon / php-multidimensional-array-search.php
Last active November 26, 2019 10:14
PHP multidimensional array search
<?php
/*
* PHP multidimensional array search ( LIKE SEARCH )
* @since 1.0.0
*/
function searchInMultidimensionalArray($value=NULL, $items=array()){
$getItems = [];
foreach ($items as $item_key => $itemDatas) {
if(is_array($itemDatas)){
foreach ($itemDatas as $dsdf =>$itemData) {
@raazon
raazon / register-rest-route.php
Last active November 26, 2019 07:01
WordPress Rest API Examples
<?php
/**************************************************************************
* ALL CUSTOM REST API ROUTES FOR 3rd PARTY USE
* @reference: https://developer.wordpress.org/rest-api/
* @since 1.0
* @author Razon
/**************************************************************************/
// ALL CUSTOM REST ROUTE'S
add_action( 'rest_api_init', function () {
@raazon
raazon / reset-form-fields.js
Last active November 24, 2019 07:06
Reset form fields by JavaScript
// RESET FORM FIELDS BY RAZON
function resetFormFieldsValue(formFields){
for(var count = 0; count < formFields.length; count++) {
formFields[count].value = '';
}
}
var formFields = document.querySelectorAll('.checkout input, .checkout select'); // all input & select fields.
resetFormFieldsValue(formFields);
@raazon
raazon / english2bengali.php
Created November 11, 2019 09:38
Convert a English number to Bengali (Bangla) number
<?php
// Convert a English Number to Bengali (Bangla) Number
// REF: https://gist.github.com/nasirkhan/9778412
function en2bnNumber ($number){
$search_array= array("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
$replace_array= array("১", "২", "৩", "৪", "৫", "৬", "৭", "৮", "৯", "০");
$en_number = str_replace($search_array, $replace_array, $number);
return $en_number;
}
@raazon
raazon / wp-http-api.php
Last active November 6, 2019 06:57
Wordpress http api
<?php
/*
* Ref 1: https://developer.wordpress.org/plugins/http-api/
* Ref 2: https://developer.wordpress.org/reference/functions/wp_remote_request/
* Dummy API Credit: https://jsonplaceholder.typicode.com/
*/
// Get a resource
$args = array(
'method' => 'GET',