Skip to content

Instantly share code, notes, and snippets.

View atapatel's full-sized avatar
😇
Eat, Code.... Repeat

Ajay Patel atapatel

😇
Eat, Code.... Repeat
View GitHub Profile
@atapatel
atapatel / sql
Created May 25, 2021 11:48
demo query
select *, (select sum(o2.tax_total) from orders o2 where find_in_set(o2.order_id,x.order_ids) ) from (
SELECT
t.name,
sum(oi.qty * oi.origin_price) as gross_sales,
count(DISTINCT o.order_id) as total_orders,
(sum(oi.qty * oi.origin_price) / count(DISTINCT o.order_id)) as aov,
sum((oi.origin_price - oi.checkout_price) * oi.qty) as discounts,
sum(oi.qty * if(av.variant_id is null or av.price_type = 2, 1, 0)) as sold_units,
sum(oi.qty * if(av.variant_id is not null and av.price_type = 1, if(av.variant_type = 1, av.variant_qty, av.variant_qty * 3.5), 0)) as sold_grams,
@atapatel
atapatel / viewer-wave.php
Created January 5, 2021 07:23
Viewer Wave Php file
<?php
require_once 'stimulsoft/helper.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Stimulsoft Reports.PHP - JS Viewer</title>
@atapatel
atapatel / gitst file
Created December 15, 2020 13:35
git file
gist file
SELECT SQL_CALC_FOUND_ROWS wp_570_posts.ID
FROM wp_570_posts
INNER JOIN wp_570_postmeta AS fdi1 ON (wp_570_posts.ID = fdi1.post_id)
INNER JOIN wp_570_postmeta AS fdi2 ON (wp_570_posts.ID = fdi2.post_id)
INNER JOIN wp_570_postmeta AS fdi_stocknumberpostmeta ON wp_570_posts.id = fdi_stocknumberpostmeta.post_id
AND fdi_stocknumberpostmeta.meta_key = 'stock'
WHERE 1=1
AND (
wp_570_posts.post_title REGEXP '/\b(new)\b/'
OR wp_570_posts.post_excerpt REGEXP '/\b(new)\b/'
ab -n 1000 -c 200 http://hhvm.fox.bakeapps.com/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking hhvm.fox.bakeapps.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
ab -n 1000 -c 200 http://php.fox.bakeapps.com/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking php.fox.bakeapps.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
ab -n 1000 -c 200 http://hhvm.fox.bakeapps.com/
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking hhvm.fox.bakeapps.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
select * from ((SELECT disp_id,
'both',
'All',
'INACTIVE',
now() as created_at,
now() as updated_at,
NULL
FROM dispensaries
UNION All
SELECT disp_id,
[2019-10-23 10:51:00] production.ERROR: Trying to get property 'name' of non-object {"userId":6,"exception":"[object] (ErrorException(code: 0): Trying to get property 'name' of non-object at /var/www/vsshah.co/app/Reports/ProductionReport.php:73)
[stacktrace]
#0 /var/www/vsshah.co/app/Reports/ProductionReport.php(73): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Trying to get p...', '/var/www/vsshah...', 73, Array)
#1 /var/www/vsshah.co/vendor/koolreport/core/src/KoolReport.php(100): App\\Reports\\ProductionReport->setup()
#2 /var/www/vsshah.co/app/Http/Controllers/ReportController.php(150): koolreport\\KoolReport->__construct()
#3 [internal function]: App\\Http\\Controllers\\ReportController->getProductionReport('report')
#4 /var/www/vsshah.co/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#5 /var/www/vsshah.co/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAct
[2019-10-23 10:49:48] production.ERROR: The Response content must be a string or object implementing __toString(), "object" given. {"userId":6,"exception":"[object] (UnexpectedValueException(code: 0): The Response content must be a string or object implementing __toString(), \"object\" given. at /var/www/vsshah.co/vendor/symfony/http-foundation/Response.php:401)
[stacktrace]
#0 /var/www/vsshah.co/vendor/laravel/framework/src/Illuminate/Http/Response.php(45): Symfony\\Component\\HttpFoundation\\Response->setContent(Object(koolreport\\excel\\FileHandler))
#1 /var/www/vsshah.co/vendor/symfony/http-foundation/Response.php(202): Illuminate\\Http\\Response->setContent(Object(koolreport\\excel\\FileHandler))
#2 /var/www/vsshah.co/vendor/laravel/framework/src/Illuminate/Routing/Router.php(748): Symfony\\Component\\HttpFoundation\\Response->__construct(Object(koolreport\\excel\\FileHandler))
#3 /var/www/vsshah.co/vendor/laravel/framework/src/Illuminate/Routing/Router.php(720): Illuminate\\Routing\\Router::toResponse(O