Skip to content

Instantly share code, notes, and snippets.

View ssatz's full-sized avatar
🏠
Working from home

sathish ssatz

🏠
Working from home
View GitHub Profile
@ssatz
ssatz / .dbs
Created May 19, 2023 07:00 — forked from raymadrona/.dbs
MySQL Replication Tuned for Laravel
simmfins
simmfins_trail
select `email` as Email,IFNULL(SUBSTRING_INDEX(name,' ',1),"") AS "First Name",IFNULL(SUBSTRING_INDEX(name,' ',-1),"") AS "Last Name", IFNULL(CONCAT("91 ",`mobile`),"") as Phone,IFNULL(`pincode`,"") as Zip ,"IN" as Country from users left join address on address.user_id=users.id
@ssatz
ssatz / pullrequest.md
Created July 13, 2020 14:53
PullRequest
@ssatz
ssatz / builder.php
Created May 24, 2020 10:49 — forked from ollieread/builder.php
Laravel query builder recursive CTE support
<?php
$recursive = $this->query()
->recursive('parents', function (Builder $query) {
$query
->select([
'*',
new Alias('slug', 'fullslug'),
new Alias(0, 'depth'),
new Alias('id', 'tree_id'),
new Alias('name', 'path'),
@ssatz
ssatz / README.md
Created May 18, 2020 13:33 — forked from hofmannsven/README.md
Notes on working with SVG on the web
@ssatz
ssatz / sharethis.js
Last active January 7, 2020 08:33
Share this API for SPA
if (__sharethis__ && __sharethis__.config) {
__sharethis__.init(__sharethis__.config);
}
@ssatz
ssatz / gist:bf8b4c96c5d41a2d83bd6b979a4998b8
Last active April 6, 2020 14:55
set timezone in Ubuntu Terminal
sudo timedatectl set-timezone Asia/Calcutta
date //will display current date and time
@ssatz
ssatz / preg split.php
Created February 22, 2019 08:29
preg split
<?php
$e =preg_split('/(?=[\s][0-9]+)/i','Red chilli powder 2.50 tbsp');
print_r($e);
//Array ( [0] => Red chilli powder [1] => 2.50 tbsp )
@ssatz
ssatz / WP-Query
Created January 14, 2019 13:09 — forked from hoangitk/WP-Query
SQL Query to get Latest Wordpress Post with Featured Image.
select DISTINCT wp_posts.id, wp_posts.post_title, wp_posts.post_content, wp_posts.post_type, featured_image.guid as post_image, wp_posts.post_modified, wp_users.display_name
from wp_posts
inner join wp_postmeta on wp_posts.id = wp_postmeta.post_id and wp_postmeta.meta_key = '_thumbnail_id'
inner join wp_posts as featured_image on featured_image.id = wp_postmeta.meta_value
inner join wp_users on wp_users.id = wp_posts.post_author
where wp_posts.post_status = 'publish'
order by wp_posts.ID desc
limit 10
@ssatz
ssatz / sql_wp.sql
Created January 14, 2019 06:17
Wordpress Get POST With Terms(with Category)
SELECT * FROM wp_posts LEFT JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id)
LEFT JOIN wp_term_taxonomy
ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
LEFT JOIN wp_terms
ON (wp_term_relationships.term_taxonomy_id = wp_terms.term_id)
WHERE wp_posts.post_type = 'post'
AND wp_term_taxonomy.taxonomy = 'category'
ORDER BY
post_date DESC;