Skip to content

Instantly share code, notes, and snippets.

View akshuvo's full-sized avatar

Akhtarujjaman Shuvo akshuvo

View GitHub Profile
@akshuvo
akshuvo / timezone-options-select.html
Created April 11, 2023 17:55
Timezone Option Select
<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">
<optgroup label="Africa">
<option value="Africa/Abidjan">Abidjan</option>
<option value="Africa/Accra">Accra</option>
<option value="Africa/Addis_Ababa">Addis Ababa</option>
<option value="Africa/Algiers">Algiers</option>
<option value="Africa/Asmara">Asmara</option>
<option value="Africa/Bamako">Bamako</option>
<option value="Africa/Bangui">Bangui</option>
<option value="Africa/Banjul">Banjul</option>
@akshuvo
akshuvo / download-file-by-url.php
Created October 18, 2022 20:17 — forked from maheshwaghmare/download-file-by-url.php
Download file by URL and move in uploads directory
<?php
/**
* Download File In Uploads Directory
*
* Eg.
*
* $file = download_file( `file-url` );
*
* if( $file['success'] ) {
* $file_abs_url = $file['data']['file'];
@akshuvo
akshuvo / commands.md
Last active September 6, 2022 22:51
SVN Commands for WordPress Plugin

Checkout Repo

svn co https://plugins.svn.wordpress.org/your-plugin-name my-local-dir

Add All (force)

svn --force --depth infinity add .

SVN Commit

svn ci -m 'Update'

@akshuvo
akshuvo / form.php
Created June 2, 2022 23:06
WordPress Ajax Form Submit Example
<div class="my-form-wrap">
<form class="custom-form-class" action="#" autocomplete="off" method="POST">
<!-- Action is here but hidden. This will be use in php side -->
<input type="hidden" name="action" value="sample_custom_form_action">
<input class="input" type="text" spellcheck="false" name="name" placeholder="Name" required>
<input class="input" type="email" spellcheck="false" name="email" placeholder="E-mail" required>
@akshuvo
akshuvo / gub-teachers-evolution-script.js
Created April 21, 2022 16:52
Paste this code in browser console.
// Check radio values 5
var toCheck = document.querySelectorAll('[value="5"]');
toCheck.forEach(function(el, i){
el.checked = true;
});
// Check radio values 10
var toCheck = document.querySelectorAll('[value="10"]');
toCheck.forEach(function(el, i){
el.checked = true;
@akshuvo
akshuvo / ghost-loading-skeleton.css
Created March 24, 2022 16:04
Ghost Loading Skeleton HTML, CSS
.skeleton {
border-radius: 3px;
-webkit-animation: skeleton 0.5s infinite alternate;
animation: skeleton 0.5s infinite alternate;
-webkit-animation-delay: 0s;
animation-delay: 0s;
background-color: rgba(0, 0, 0, 0.02);
}
.large.skeleton {
height: 1.5em;
@akshuvo
akshuvo / TcpFlowControl.java
Created September 10, 2021 10:34
Implement TCP flow control mechanism using sliding window protocol java code.
package com.mycompany.dfs;
import static java.lang.Math.random;
import java.util.Scanner;
import java.util.Random;
public class TcpFlowControl {
public static int generateFrame(int winSize) {

Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. If you know the author, please let me know so I give the attribution.

Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can.

Mac Network Commands Cheat Sheet

After writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Good luck out there, and stay salty.

Get an ip address for en0:

<?php
/**
* Get All Products from Last Month
*/
add_shortcode('wc_get_products_last_month', function( $atts, $content = null ){
$start_date = array(
'year' => date("Y", strtotime("first day of previous month")),
'month' => date("n", strtotime("first day of previous month")),
@akshuvo
akshuvo / function.php
Created January 10, 2021 12:01
Load custom page templates from plugin for custom post type
<?php
function wpse255804_add_page_template ($templates) {
$templates['custom-template-1'] = 'Custom Template 1';
$templates['custom-template-2'] = 'Custom Template 2';
$templates['custom-template-3'] = 'Custom Template 3';
return $templates;
}
add_filter ('theme_tourfic_templates', 'wpse255804_add_page_template');
// Single Template