Skip to content

Instantly share code, notes, and snippets.

View ibrahimtuzlak0295's full-sized avatar

Ibrahim Tuzlak ibrahimtuzlak0295

View GitHub Profile
@ibrahimtuzlak0295
ibrahimtuzlak0295 / phpstan.neon
Last active June 16, 2024 05:39
A Laravel/Larastan `phpstan.neon` that works well with ide-helper and phpstorm
includes:
- ./vendor/nunomaduro/larastan/extension.neon
parameters:
paths:
- app/
# Level 9 is the highest level
level: 5
@ibrahimtuzlak0295
ibrahimtuzlak0295 / ubuntu-switch-between-php-versions.md
Created January 31, 2022 10:11
Change default PHP version, Ubuntu (e.g. with ppa:ondrej/php)
$ sudo update-alternatives --config php # and then pick a number from the list
@ibrahimtuzlak0295
ibrahimtuzlak0295 / http-https-string.md
Last active November 8, 2019 19:49
Filter a value in a way that it always must be prepended with either http:// or https://.
/**
 * Filter a value in a way that it always must be prepended with either http:// or https://.
 * Useful when we must be sure a string will be treated as a URL.
 * @param  string $string Value to filter
 * @return string         Value prefixed with http:// or https:// 
 */
function httpize_string(string $string) : string
{
	return preg_match('{https?://}', $string) ? $string : 'http://' . $string;
@ibrahimtuzlak0295
ibrahimtuzlak0295 / composer-global-require-no-sudo.md
Last active October 13, 2019 20:14
Use `composer global require` without `sudo` AND without permission errors

Use composer global require without sudo AND without permission errors

Composer is not supposed to be ran as sudo / root, but at the same using the global (or -g) argument might give us permission errors. To fix this, we need to change ownership of the ~/.composer directory to the current user:

$ sudo chown -R $USER:$USER ~/.composer
@ibrahimtuzlak0295
ibrahimtuzlak0295 / xampp-virtualhost.md
Last active May 24, 2023 16:21
Create virtual host in XAMPP, Ubuntu 16.04/18.04/20.04/22.04

I’ll go step-by-step on how to create a virtual host in the XAMPP environment. As we know, the default http://localhost points to /opt/lampp/htdocs as the root directory. The desired result is to be able to visit http://examplevhost.local, with the root directory being /opt/lampp/htdocs/examplevhost.

Note: The steps below are done on Ubuntu 16.04, but they should also work on most other Linux distributions (Debian, Mint, Arch).

Note: I’ll assume that XAMPP is installed in /opt/lampp/. If it’s different on your setup, please read carefully and adjust accordingly.

Enable virtual hosts in apache configuration file

Note: This should be done only once per XAMPP installation. If you want to add another virtual host later you can skip to the next step.

@ibrahimtuzlak0295
ibrahimtuzlak0295 / pol-corefonts.md
Last active October 3, 2024 14:42
PlayOnLinux is not installing MS Core Fonts, Ubuntu

The POL Way

Normally the Microsoft Core Fonts can be installed like this:

  • Click Configure
  • Select the prefix where you want the fonts installed
  • Tab Install components
  • Select Microsoft Core Fonts from the list and click Install

Manually

@ibrahimtuzlak0295
ibrahimtuzlak0295 / htdocs-permissions.md
Created February 4, 2018 13:54
Apache htdocs permissions after installing XAMPP on Linux

After installing XAMPP on Linux, the htdocs folder (default: /opt/lampp/htdocs) can only be written to by root. Although this is normal since the installer has been executed as root, we would still like to be able to create, edit, and remove content from htdocs within our file manager or text editor, without the need for sudo.

Requirements:

  • XAMPP installed
  • sudo

Note: The steps below are done on Ubuntu 16.04, but they should also work on any other Linux distribution.

Warning: These permissions are safe on local environments such as XAMPP. I do not recommend using this for production.

@ibrahimtuzlak0295
ibrahimtuzlak0295 / vlc-gtk-open-dialog.md
Last active October 3, 2024 15:30
Fix VLC GTK Open Dialog on Ubuntu

Install the libqt5libqgtk2 package:

$ sudo apt-get install libqt5libqgtk2

@ibrahimtuzlak0295
ibrahimtuzlak0295 / node-not.found.md
Last active October 3, 2024 15:29
Fix /usr/bin/env: ‘node’: No such file or directory

$ sudo ln -s /usr/bin/nodejs /usr/bin/node