Skip to content

Instantly share code, notes, and snippets.

View askaaqib's full-sized avatar
⚒️
Same old, Same old

Aqib. askaaqib

⚒️
Same old, Same old
  • Pakistan
View GitHub Profile
@askaaqib
askaaqib / ajax_hook.php
Last active August 19, 2020 13:40
WordPress AJAX Function Hook
<?php
/****** CUSTOM POST TYPE = 'SERVICES' HOOKS *******/
add_action( 'wp_ajax_get_client_timezone_info', __NAMESPACE__ . '\\getTZInfo' );
add_action( 'wp_ajax_nopriv_get_client_timezone_info', __NAMESPACE__ . '\\getTZInfo' );
add_filter( 'the_content', __NAMESPACE__ . '\\replace_hello_with_good_morning' );
function replace_hello_with_good_morning($content){
session_start();
if(get_post_type()=='services'){
@askaaqib
askaaqib / category-permastructure.php
Last active August 20, 2020 15:54
WordPress Category Permastructure
<?php
function wpa85084_category_permastruct(){
global $wp_rewrite;
$wp_rewrite->extra_permastructs['category']['struct'] = '/blog/%category%/';
}
add_action( 'init', 'wpa85084_category_permastruct' );
add_action( 'init', 'wpa58471_category_base' );
function wpa58471_category_base() {
// Remember to flush the rules once manually after you added this code!
@askaaqib
askaaqib / custom-form-plugin.php
Last active August 20, 2020 15:55
WordPress Custom Contact Form Plugin
<?php
/**
* Plugin Name: Investment Calculator
* Plugin URI:
* Description: Investment Calculator
* Version: 1.0
* Author: James Allen
* Author URI:
*/
@askaaqib
askaaqib / agile-debug.php
Last active August 21, 2020 16:21
WordPress Custom Debug Plugin
<?php
/*
Plugin Name: Agile Debug
Plugin URI:
Description: Helps in developing/debugging Wordpress
Author: Aqib
Version: 1.4
Author URI: http://github.com
*/
@askaaqib
askaaqib / agile-debug-admin.css
Created August 21, 2020 16:41
Agile Debug CSS ADMIN
.agile_dbg_collapsible{
background: none repeat scroll 0 0 #CCCCCC;
border-top: 1px solid #F0F0F0;
color: #000000;
font-family: Arial,Helvetica,sans-serif;
@askaaqib
askaaqib / installDocker.sh
Last active October 2, 2020 13:40
Install Docker Ubuntu
apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
apt update
apt-cache policy docker-ce
apt install docker-ce
sudo curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
@askaaqib
askaaqib / sign_verify_signature.php
Created October 16, 2020 06:34
ECDSA, Sign and Verify Signature
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use FurqanSiddiqui\ECDSA\ECDSA;
use FurqanSiddiqui\ECDSA\Curves\Secp256k1;
use Comely\DataTypes\Buffer\Base16;
use \kornrunner\Keccak;
@askaaqib
askaaqib / ecdsa.php
Last active October 19, 2020 13:37
ECDSA, Private to Public
<?php
declare(strict_types=1);
require "../vendor/autoload.php";
use FurqanSiddiqui\ECDSA\ECDSA;
use FurqanSiddiqui\ECDSA\Curves\Secp256k1;
use Comely\DataTypes\Buffer\Base16;
use \kornrunner\Keccak;
@askaaqib
askaaqib / ethereum-php.php
Last active October 28, 2020 05:14
Ethereum Php Library
<?php
require "../vendor/autoload.php";
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
$eth->networkConfig()->setChainId(3);
echo "<pre>";
//// CREATE PRIVATE KEY
$prv = $eth->keyPairs()->privateKeyFromEntropy(hash("sha256", "whocares1"));
@askaaqib
askaaqib / ethereum-testing.php
Last active November 2, 2020 07:34
Ethereum Testing
<?php
require "../vendor/autoload.php";
$eth = new \FurqanSiddiqui\Ethereum\Ethereum();
echo "<pre>";
//// CREATE PRIVATE KEY
//$prv = $eth->keyPairs()->privateKeyFromEntropy(hash("sha256", "whocares1"));
//$prv1 = $eth->keyPairs()->privateKeyFromEntropy(hash("sha256", "whocares2"));
//