This can be a little confusing as the syntax barely changes but it makes a big difference.
This seems harmless, but I'll explain why it can be bad for performance
$post->comments->count();
| #!/bin/bash | |
| # when running `php artisan native:install`, when prompted to start the development server select "no" | |
| # copy this file within the root of your project/application and run it `bash nativephp-linux-patch.sh` | |
| # after running this script run `php artisan native:serve` | |
| sed -i 's/app.dock.setIcon(state_1.default.icon);/\/\/app.dock.setIcon(state_1.default.icon);/g' vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/index.js | |
| cp -L /usr/bin/php vendor/nativephp/php-bin/bin/mac/x86/php |
| // see https://learn.snyk.io/lesson/prototype-pollution/ for additional information and great explanations | |
| // recursively update target with source data | |
| function merge(target, source) { | |
| for (const attr in source) { | |
| if ( | |
| typeof target[attr] === "object" && | |
| typeof source[attr] === "object" | |
| ) { | |
| merge(target[attr], source[attr]) |
| ##### dataCount: 10000, seletCount: 1, limit: 5000 ##### | |
| PhpClickhouse 0.076 | |
| SeasClickNonCompression 0.062 | |
| SeasClickCompression 0.064 | |
| OneCk 0.095 | |
| -------------------------------- | |
| Total 0.297 | |
| ##### dataCount: 10000, seletCount: 1, limit: 5000 ##### | |
| PhpClickhouse 0.051 |
| <?php | |
| declare(strict_types=1); | |
| /** | |
| * Tested with PHP 8.1 | |
| * Create a sqlite file named `secrets.db` in the same directory | |
| * Required extensions: sqlite3/pdo_sqlite, openssl | |
| * Recommended extension: uuid | |
| * |
| <?php | |
| declare(strict_types=1); | |
| /** | |
| * src/ | |
| * Domain/ | |
| * Entity/ | |
| * Factory/ | |
| * Repository/ // repository interfaces |
| <?php | |
| use Illuminate\Database\Eloquent\Model; | |
| use Illuminate\Database\Eloquent\ModelNotFoundException; | |
| use Illuminate\Database\Eloquent\RelationNotFoundException; | |
| use Illuminate\Support\Facades\App; | |
| use Illuminate\Support\Facades\DB; | |
| use Illuminate\Support\Str; | |
| class HasManyUpdater |
| # config/routes.rb | |
| namespace :admin do | |
| get 'dashboard' => 'dashboard#index' | |
| end | |
| # app/controllers/admin/admin_controller.rb | |
| include SessionsHelper | |
| class Admin::AdminController < ApplicationController | |
| http_basic_authenticate_with name: "johndoe", password: "secret" |
Part 2! This is an overview of things I've learnt while working on my side project Anon Forum in Ruby on Rails.
Today's topics:
This is an overview of things I've learnt while working on my side project anonforum in Ruby on Rails.
Today's topics: