Skip to content

Instantly share code, notes, and snippets.

View JFOC's full-sized avatar
🎯
Focusing

JFOC JFOC

🎯
Focusing
View GitHub Profile
@ArrayIterator
ArrayIterator / PolygonFixer.php
Created February 19, 2020 08:02
Fix Right Hand Rule Geo JSON clockwise
<?php
declare(strict_types=1);
namespace ArrayIterator;
/**
* Class PolygonFixer
* @package ArrayIterator
* Like a Geo Jeon right-hand-rule Fixer based on {@link https://mapster.me/right-hand-rule-geojson-fixer/}
@techjewel
techjewel / address_rearrange.php
Created February 6, 2020 16:32
Address Rearrange for Fluent Forms
<?php
add_filter('fluenform_rendering_field_data_address', function ($data) {
$fields = $data['fields'];
// You can re-arrange the fields here
$data['fields'] = array_merge(array_flip(array(
'address_line_1',
'address_line_2',
'zip',
<?php
add_filter('fluenform_rendering_field_data_select', function ($data, $form) {
if ($form->id != 91) {
return $data;
}
// do the dynamic part if and only the name attriibute is 'dynamic_dropdown'
// Please use the corresponding field name for your case.
if (\FluentForm\Framework\Helpers\ArrayHelper::get($data, 'attributes.name') != 'dynamic_dropdown') {
return $data;
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active May 29, 2025 17:34
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
@romanitalian
romanitalian / wp_make_new_site.sh
Last active November 26, 2024 14:51
BASH script to make new WP site: download and WP, configure and restart NGINX; install/make wordpress site by Bash script; wordpress install; wordpress configuration; wordpress initialisation
#!/bin/bash
# -------------------------------------------------
# Make site directory
# Download WP and install WP to site directory
# Set WP configuration
# Configure NGINX for new domain-name
# -------------------------------------------------
# apt-get update
@yankiara
yankiara / customization-plugin.php
Last active October 22, 2024 07:46
Oxygen Builder dummy theme used to increase plugins compatibility
/**
* Oxy-Dummy activation (thank you Sridhar Katakam)
* Paste this code snippet in your Oxygen's customization plugin
* or copy the file to /wp-content/plugins/customization-plugin/
*/
remove_filter( 'template', 'ct_oxygen_template_name' );
remove_filter( 'template_directory', 'ct_disable_theme_load', 1, 1 );
remove_filter( 'stylesheet_directory', 'ct_disable_theme_load', 1, 1 );
@linuxkathirvel
linuxkathirvel / how-to-boot-iso-in-kvm-using-xml.md
Last active May 19, 2025 10:14
How to boot ISO image in KVM using XML configuration?

How to boot ISO image in KVM using XML configuration?

<disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/data_ssd/iso-images/ubuntu-16.04.6-server-amd64.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <boot order='1'/>
 
@aurelioluiz
aurelioluiz / mamp-php-gmp.md
Last active October 28, 2021 06:46
How to install GMP extension for PHP 7.2 using MAMP

Installing GMP extension for PHP 7.2 using MAMP

You have to build the GMP extension from the PHP source code. First install Autoconf and GMP using Homebrew.

brew install autoconf gmp

Download and unpack PHP.

@theodorejb
theodorejb / convert_array_access_braces.php
Last active September 18, 2025 10:29
Migrate deprecated curly brace array access syntax to bracket syntax. Requires PHP 7.4.
<?php
error_reporting(E_ALL);
$opts = getopt('f:d:rb:', ['ext:', 'php:', 'diff::']);
if ((int)isset($opts['d']) + (int)isset($opts['f']) !== 1) {
$self = basename(__FILE__);
echo <<<EOF
Usage:
php $self -f<php_script> [-b] [--php <path_to_php>] [ --diff [<file>]]
@rolandstarke
rolandstarke / laravel setup.sh
Last active June 16, 2025 10:54
Server setup bash script for Laravel
# Ubuntu 20 LTS Server Setup for Laravel
# Login as root user
sudo su -
# Update list of available packages
apt update