Skip to content

Instantly share code, notes, and snippets.

View anatoliy-t7's full-sized avatar
💭
Stand With Ukraine

Anatoliy anatoliy-t7

💭
Stand With Ukraine
  • Planet Earth
View GitHub Profile
@anatoliy-t7
anatoliy-t7 / Envoy.blade.php
Last active January 4, 2023 05:59
Laravel Envoy with zero downtime
@setup
require __DIR__.'/vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
try {
$dotenv->load();
$dotenv->required(['APP_NAME', 'DEPLOY_SERVER', 'DEPLOY_REPOSITORY', 'DEPLOY_PATH', 'DEPLOY_BRANCH', 'LOG_SLACK_WEBHOOK_URL'])->notEmpty();
} catch ( Throwable $e ) {
echo $e->getMessage();
exit;
@mithicher
mithicher / m-editor.blade.php
Last active May 3, 2024 01:44
Markdown Editor Component with AlpineJS & Laravel Blade
@props([
'id' => 'editor-'. str()->random(8),
'height' => '400px',
'label' => null,
'name' => null,
'value' => null,
'noMargin' => false,
'readonly' => false,
'disabled' => false,
'toolbar' => true
@tanthammar
tanthammar / trix.blade.php
Last active February 8, 2023 22:18
Livewire trix input
@push('body-styles')
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/trix/1.2.0/trix.css">
@endpush
<form x-data="form()">
<input x-ref="description" id="description" name="description" value='{{ $description }}' type="hidden" />
<div wire:ignore>
<trix-editor input="description"></trix-editor>
</div>
@prashant-shahi
prashant-shahi / instruction.md
Last active June 2, 2024 19:20
Recover from ufw not allowing to ssh on port 22 in GCP instance

SSH Firewall

Tried to setup UFW or any other Firewall, but it disallows any traffic to port 22, which doesn't let you ssh to your Google Cloud Platform (GCP) instance? 😖

This article might be your savior. 😎

Follow the instructions below :

  1. Go to your VM’s configuration page. Select the project. Then, Go to Compute -> Compute Engine -> VM Instances. Click the VM you want to recover
  2. Click Edit. Then, scroll down to Custom Metadata
@Jon007
Jon007 / woo-poly-additional-email.php
Created March 31, 2019 11:48
Add additional email handling to woo-poly-integration
<?php
/*
* when switching language for order email, unload these additional text domains
*/
function ii_unload_email_textdomains() {
unload_textdomain( 'inkston-integration' );
unload_textdomain( 'woo-advanced-shipment-tracking' );
}
add_action( 'woo-poly.Emails.switchLanguage', 'ii_unload_email_textdomains' );
/*
@WillBrubaker
WillBrubaker / file.php
Created December 12, 2018 11:35
WooCommerce redirect to cart if trying to add a 'sold individually' item that is already in the cart
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_add_to_cart_sold_individually_found_in_cart', 'handsome_bearded_guy_maybe_redirect_to_cart' );
function handsome_bearded_guy_maybe_redirect_to_cart( $found_in_cart ) {
if ( $found_in_cart ) {
wp_safe_redirect( wc_get_page_permalink( 'cart' ) );
exit;
}
@ontiuk
ontiuk / woocommerce-select2-selectwoo-remove
Last active May 17, 2023 13:55
Woocommerce Remove Select2 / SelectWoo
// Add to your theme's functions.php file. De-queues Select2 styles & scripts. Useful to keep Boostrap form control formatting
/**
* Remove Woocommerce Select2 - Pre WC 3.2.1-ish
*/
function woo_dequeue_select2() {
if ( class_exists( 'woocommerce' ) ) {
wp_dequeue_style( 'select2' );
wp_deregister_style( 'select2' );
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active June 17, 2024 18:36
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@damiencarbery
damiencarbery / polylang-get-woocommerce-translated-page-id.php
Created May 17, 2017 12:46
Return ID of translated WooCommerce page
<?php
/*
Plugin Name: Return translated WooCommerce page
Plugin URI: http://www.damiencarbery.com
Description: Required Polylang plugin. Returns ID of translated page.
Author: Damien Carbery
Version: 0.1
*/
// A safe version of code suggested at:
@simonhamp
simonhamp / AppServiceProvider.php
Last active June 12, 2024 11:05
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()