Skip to content

Instantly share code, notes, and snippets.

View k2so-dev's full-sized avatar

Web Artisan k2so-dev

View GitHub Profile
@viezel
viezel / octane-on-forge.md
Last active July 20, 2025 00:03
Quickly get Octane running on Laravel Forge

Quickly get Octane running on Laravel Forge

  1. Spin up a new App server, choose PHP 8
  2. SSH into it and run sudo -i to become root
  3. Run pecl install swoole and enable what you need. (I disabled curl as it did not work for me)
  4. Add a new Site to your server and use git to pull in your Laravel project that has Octane installed.
  5. Point your DNS to your new site
  6. Enable SSL using Lets Encrypt
  7. Change your new Sites Nginx settings to (assuing your site is named octane.example.com):
@mariuskubilius
mariuskubilius / extractTranslationStrings.php
Created January 23, 2019 15:09
Laravel artisan command to extract translation strings from templates and add them into {language}.json file for localization.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
class extractTranslationStrings extends Command
{
@azimidev
azimidev / .htaccess
Last active August 19, 2023 05:53
The Best .htaccess with browser caching and gzip
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
@lesstif
lesstif / Dumper.php
Last active November 5, 2019 01:08
laravel's dump(), dd() helper function clone.
<?php
namespace your\namespace;
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
class Dumper
{
@marktopper
marktopper / PageController.php
Last active December 24, 2020 20:55
[Voyager] Routes for Pages BREAD
<?php
class PageController extends \App\Http\Controllers\Controller
{
public function show()
{
$slug = request()->segment(1);
$page = \TCG\Voyager\Models\Page::where('slug', $slug)
->firstOrFail();
@pbolduc
pbolduc / 1. Install Redis
Last active July 3, 2023 09:39 — forked from nghuuphuoc/1) Install
Install redis on CentOS 7
# see How to Install Redis Server on CentOS 7 - http://linoxide.com/storage/install-redis-server-centos-7/
# --- Compiling ---
$ yum install gcc make tcl
$ REDIS_VER=3.2.3
$ wget http://download.redis.io/releases/redis-$REDIS_VER.tar.gz
$ tar xzvf redis-$REDIS_VER.tar.gz
$ cd redis-$REDIS_VER
$ make
$ make test
@champsupertramp
champsupertramp / Ultimate Member - Custom Email Template
Last active December 16, 2023 21:59
Ultimate Member - Custom Email Template
<?php
/***
*** Custom Email Template
****/
function um_custom_email_template(){
global $ultimatemember, $user_ID;
um_fetch_user( $user_ID );
@jgarciaruiz
jgarciaruiz / Added my custom column hpd
Created October 19, 2015 17:11
Add custom field column to WC products admin table
/* WC HPD */
//manage_product_posts_custom_column
add_filter( 'manage_edit-product_columns', 'products_customcol_fn' );
function products_customcol_fn($columns){
$new_columns = (is_array($columns)) ? $columns : array();
$new_columns['HPD'] = 'hpd';
return $new_columns;
}
add_action( 'manage_product_posts_custom_column', 'products_customcol_value_fn', 2 );
@yratof
yratof / functions.php
Created March 25, 2015 16:43
Advanced Custom Fields - Update Gallery with Gravity Forms
$gravity_form_id = 6; // gravity form id, or replace {$gravity_form_id} below with this number
add_filter("gform_after_submission_{$gravity_form_id}", 'jdn_set_post_acf_gallery_field', 10, 2);
function jdn_set_post_acf_gallery_field($entry, $form)
{
$gf_images_field_id = 42; // the upload field id
$acf_field_id = 'field_54804833b3067'; // the acf gallery field id
// get post
@salcode
salcode / .gitignore
Last active September 27, 2025 02:50
See https://salferrarello.com/wordpress-gitignore/ for the latest version of my WordPress .gitignore file
# -----------------------------------------------------------------
# .gitignore for WordPress
# Bare Minimum Git
# http://ironco.de/bare-minimum-git/
# ver 20150227
#
# This file is tailored for a WordPress project
# using the default directory structure
#
# This file specifies intentionally untracked files to ignore