Skip to content

Instantly share code, notes, and snippets.

@ryuchix
ryuchix / gist:aadc0d28063b39dff74acb3602813e98
Last active April 26, 2023 00:31
Running Laravel on AWS using docker
//Connect AWS to github using ssh
ssh-keygen -t rsa -b 4096 -C "[email protected]"
cat /home/ubuntu/.ssh/id_rsa.pub
copy the key and paste it on Github SSH keys
touch ~/.ssh/authorized_keys
cat id_rsa.pub >> ~/.ssh/authorized_keys
Clone the repo
Multiple sitemap index
$sitemapIndex = SitemapIndex::create();
$productChunks = Product::select(['slug', 'updated_at'])
->chunk(50000, function ($products, $chunk) use ($sitemapIndex) {
$sitemapName = 'products_sitemap_'.$chunk.'.xml';
$sitemap = Sitemap::create();
foreach ($products as $product) {
@ryuchix
ryuchix / example-wp-list-table.php
Created September 16, 2021 07:07 — forked from paulund/example-wp-list-table.php
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@ryuchix
ryuchix / gist:ddaa45901a5684af9ed5dbbb27fcaa5d
Created August 24, 2021 06:39
Remove duplicate from multiple dimensional array
$datas = [
{
"email":"[email protected]",
"jobid":803432
},
{
"email":"[email protected]",
"jobid":803432
},
{
@ryuchix
ryuchix / gist:f5e061666ea66a78eb8229e070fad5dc
Created January 5, 2021 13:09
Storefront Api. List all published products
{
products(first: 20, query: "published_status:published AND available_for_sale:true") {
edges {
node {
id
title
description
publishedAt
images(first: 250) {
edges {
@ryuchix
ryuchix / gist:919264091f9c53a22762532574ccb726
Created January 5, 2021 13:08
Storefront api. Query by single product using handle
{
productByHandle(handle: "made-of-krimpen-dcv-unisex-essential-crew-neck-t-shirt") {
id
title
handle
description
productType
publishedAt
images(first: 100) {
edges {
@ryuchix
ryuchix / gist:bab5286f5b60055ac5aab0ecef0d9846
Last active December 29, 2020 02:56
Set composer.json to detect specific php version
Here's how I did it
Enter in Terminal:
nano ~/.bash_profile
Then add the following
export MAMP_PHP=/Applications/MAMP/bin/php/php5.5.26/bin
export PATH="$MAMP_PHP:$PATH"
Hit Ctrl + X to save
Then again in Command Line
@ryuchix
ryuchix / Install Composer to use MAMP's PHP.md
Created December 29, 2020 02:45 — forked from kkirsche/Install Composer to use MAMP's PHP.md
How to install Composer globally using MAMP's PHP

##Create an alias to MAMP's PHP installation

To do this, we can simply create an alias for our bash profile. We'll be doing this is nano, though you can do it in vim or a number of other editors as well.

Within the terminal, run:

nano ~/.bash_profile

This will open nano with the contents, at the top in a blank line add the following line:

DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock
@ryuchix
ryuchix / gist:0a173314f851e2050cbf662a9706d50d
Created December 21, 2020 11:46
Install composer on mac OS
$ curl -sS https://getcomposer.org/installer | php
$ chmod +x composer.phar
$ sudo mv composer.phar /usr/local/bin/composer
$ composer