Skip to content

Instantly share code, notes, and snippets.

View imranfakhrul's full-sized avatar
🎯
Focusing

Imran Fakhrul imranfakhrul

🎯
Focusing
View GitHub Profile
@imranfakhrul
imranfakhrul / install-xdebug
Created January 5, 2024 12:28
Install Xdebug for different PHP versions
While developing/testing projects in different PHP versions, I got overwhelmed by running Xdebug for every PHP version. I just want everything to be set and switch php versions and use Xdebug right away!
I use PHP 7.4, 8.0, 8.1, 8.2, 8.3 in Mac environment.
I use Herd to run PHP.
Steps to install Xdebug for every version
For 7.4
Install php@7.4 using brew
Install pecl
pecl install xdebug-3.1.6
Move the xdebug.so file to somewhere else ($HOME/xdebug/3.1.6)
Add this absolute path to php.ini
{
"shell_cmd": "g++ -std=c++17 ${file} && ./a.out<input.txt>output.txt"
}
@imranfakhrul
imranfakhrul / cp template
Last active January 22, 2023 07:10
Competitive programming template, I'll be updating it...
#include <bits/stdc++.h>
#define nl "\n"
#define ll long long
#define ull unsigned long long
#define all(v) v.begin(),v.end()
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define watch(x) cerr << "\n" << (#x) << " is " << (x) << nl;
#define iterate(i, n) for(int i = 0; i < n; i++)
#define print_printable_vector_inline(v) for(auto i:v) {cout << i << " ";}; cout << nl;
@imranfakhrul
imranfakhrul / WP_Query_arguments.php
Last active March 3, 2022 06:13
WP_Query argument structure with almost all possible arguments
// Wordpress query generator ->
// https://GenerateWP.com/wp_query/
$args = array(
'post_type' => array('post'), // use any for any kind of post type, custom post type slug for custom post type
'post_status' => array('publish'), // Also support: pending, draft, auto-draft, future, private, inherit, trash, any
'posts_per_page' => '5', // use -1 for all post
'order' => 'DESC', // Also support: ASC
'orderby' => 'date', // Also support: none, rand, id, title, slug, modified, parent, menu_order, comment_count
'tax_query' => array(