Skip to content

Instantly share code, notes, and snippets.

@todd-demone
todd-demone / WP_Query_Args.php
Created March 24, 2025 16:17 — forked from fazlurr/WP_Query_Args.php
WP_Query arguments list
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(

PHP Cheatsheet

Including PHP in a file

<?php
    // place PHP code here
?>
@todd-demone
todd-demone / wsl2-ubuntu-lamp.md
Last active August 5, 2024 18:04 — forked from abobija/wsl2-ubuntu-lamp.md
LAMP stack on WSL2 (Ubuntu 20.04) - Apache, MySQL, PHP, PhpMyAdmin

LAMP stack on WSL2 (Ubuntu 22.04.4) - Apache, MySQL, PHP, PhpMyAdmin

Apache

sudo apt-get update && sudo apt-get upgrade 
sudo apt-get install -y apache2

PHP

@todd-demone
todd-demone / psql-error-fix.md
Created May 5, 2022 17:10 — forked from AtulKsol/psql-error-fix.md
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

Lighthouse Windows 10+ WSL Setup

Quick Start

  1. Create a desktop shortcut called "Lighthouse WSL Setup" with the following:
powershell.exe iex ((New-Object System.Net.WebClient).DownloadString('https://git.io/JM2dE'))

Windows Defender sometimes mistakenly reports PowerShell shortcuts as a "threat". Its not and you can safely allow this shortcut but if you prefer, you can instead run the following command from within PowerShell (run as Admin the first time)

[
{
"body": "Great article!",
"id": 1,
"userId": 1,
"user": {
"name": "Jane",
"id": 1
}
}
const comments = await Comment.findAll( { include: User });
console.log(JSON.stringify(comments, null, 2));
[
{
"body": "Great article!",
"id": 1,
"userId": 1,
}
]
// get User data
const user = await User.findByPk(1);
// get Comment data via the 'user' instance
const comments = await user.getComments();
console.log(JSON.stringify(comments, null, 2));
Movie.belongsToMany(Actor, { through: 'ActorMovies' });
Actor.belongsToMany(Movie, { through: 'ActorMovies' });