Skip to content

Instantly share code, notes, and snippets.

Mojtaba Darvishi iMojtaba

Block or report user

Report or block iMojtaba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View sms.ir
<?php
/**
* Created by PhpStorm.
* User: mojtaba
* Date: 6/4/18
* Time: 4:25 PM
*/
class FMV_Smsir extends FMV_SMS_Abstract
{
View Test.json
{
"general": {
"b3b504a8-cd20-4a4c-ad10-1839be059bdd": {
"id": "b3b504a8-cd20-4a4c-ad10-1839be059bdd",
"title": "پیام عمومی",
"description": "این یک پیام عمومی است",
"image": false,
"start": "2019/01/10 00:00:00",
"expire": "2019/01/21 00:00:00",
"button_url": "https://zhaket.com/store/mojtaba-in/",
View Elastic email add list
<?php
$subscribers = ['ssss@ddd.com', 'sdadsafsdfds@dff.com'];
$api_key = 'API_KEY';
try {
$configuration = new \ElasticEmailClient\ApiConfiguration( [
'apiUrl' => 'https://api.elasticemail.com/v2/',
'apiKey' => $api_key
] );
$client = new \ElasticEmailClient\ElasticClient( $configuration );
$add = $client->EEList->Add(
View keybase.md

Keybase proof

I hereby claim:

  • I am imojtaba on github.
  • I am mojtabad (https://keybase.io/mojtabad) on keybase.
  • I have a public key ASBB94ymV1a0qxzysNV0bO9qpecjixylL9wS2wIoHmladwo

To claim this, I am signing this object:

@iMojtaba
iMojtaba / Download and install Persian WordPress from command line
Last active Feb 16, 2018
این اسکریپت برای دانلود و نصب آخرین نسخه از وردپرس فارسی است. کافیست آن را به مسیر /usr/bin منتقل کنید.
View Download and install Persian WordPress from command line
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
View سنگین ترین جدول‌های دیتابیس
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
View سنگین ترین جدول های دیتابیس
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10;
@iMojtaba
iMojtaba / get_customers_bought_product.php
Created Jan 15, 2017
Get customers that bought a product in woocommerce
View get_customers_bought_product.php
function get_customers_bought_product ( $product_id ) {
global $wpdb;
return $wpdb->get_results(
$wpdb->prepare( "
SELECT postmeta.meta_value as email
FROM {$wpdb->prefix}woocommerce_order_items as order_items
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta AS itemmeta ON order_items.order_item_id = itemmeta.order_item_id
LEFT JOIN {$wpdb->postmeta} AS postmeta ON order_items.order_id = postmeta.post_id
LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID
View test.php
<?php /* template name: Testssss */ ?>
<?php
$args = array(
'orderby' => 'meta_value_num',
'meta_key' => 'views',
);
$my_query = new WP_Query($args);
while ($my_query->have_posts()):
$my_query->the_post();
$do_not_duplicate = $post->ID;
View Filter Result
<?php
/* template name: Filter Result */
get_header(); ?>
<main role="main" class="main">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="search_popup_container open filter">
<div class="search_box">
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
You can’t perform that action at this time.