Skip to content

Instantly share code, notes, and snippets.

@joseederangojr
joseederangojr / laravel.sh
Last active February 10, 2024 19:54
Install LEMP, Redis, Certbot, and Supervisor
#!/usr/bin/env bash
set -e
: ${PHP_VERSION:="8.2"}
: ${NODE_VERSION:="20"}
: ${APP_REPO:="https://github.com/laravel/laravel.git"}
: ${MYSQL_ROOT_PASSWORD:=$(openssl rand -base64 32)}
: ${MYSQL_ICSP_USER:="icspdbadmin"}
: ${MYSQL_ICSP_DATABASE:="icspdb"}
: ${MYSQL_ICSP_PASSWORD:=$(openssl rand -base64 32)}
@lennardv2
lennardv2 / 1. Building PHP-MAMP on Apple Silicon M1.md
Last active February 29, 2024 07:57
Native PHP development / MAMP stack on Apple silicon M1

Building the MAMP stack (php, apache & mysql) on Apple Silicon ARM (native)

Update! This tutorial is outdated. Nowadays brew installes m1 binaries just fine. Also use valet: https://laravel.com/docs/9.x/valet. It's 10x easier.

In this tutorial, we'll build the the nescessary packages for ARM via homebrew. After that we'll configure apache2 for using virtual hosts. The native php is ofcourse way faster, see the results of this benchmark below.

TEST NAME SECONDS OP/SEC
@joseconti
joseconti / limpiar-qtranslate.sql
Created March 18, 2018 18:01
Limpiar qTranslateX
# QTRANSLATE CLEANUP QUERIES
# create temp column to separate post content on <!--more--> tag to simplify queries
ALTER TABLE `wp_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `wp_4_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
ALTER TABLE `wp_3_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
# split content
@nr1q
nr1q / qtranslate_cleanup.sql
Created August 8, 2017 22:55 — forked from frnhr/qtranslate_cleanup.sql
clean database after qTranslate uninstall
# QTRANSLATE CLEANUP QUERIES
# create temp column to separate post content on <!--more--> tag to simplify queries
ALTER TABLE `wp_posts` ADD `tmp_excerpt` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
# split content
## fill `tmp_exceprt` column
UPDATE wp_posts SET tmp_excerpt =
//CONTROLLER
public function listarPorCategoria($categoria_id, $page = 1) {
$params = array(
'fields' => array('Empresa.*'),
'conditions' => array(
'Empresa.categoria_id' => $categoria_id,
'Empresa.visivel' => 'S'
),