Skip to content

Instantly share code, notes, and snippets.

View PanjiNamjaElf's full-sized avatar
🐱
Hello nyaa~~~

Panji Setya Nur Prawira PanjiNamjaElf

🐱
Hello nyaa~~~
  • Isekai World
  • 00:55 (UTC +07:00)
View GitHub Profile
@PanjiNamjaElf
PanjiNamjaElf / in_array_vs_isset_vs_array_key_exists.php
Created August 28, 2025 03:55 — forked from alcaeus/in_array_vs_isset_vs_array_key_exists.php
Performance comparision: in-array vs. isset vs. array_key_exists
<?php declare(strict_types = 1);
function testPerformance($name, Closure $closure, $runs = 1000000)
{
$start = microtime(true);
for (; $runs > 0; $runs--)
{
$closure();
}
$end = microtime(true);
@PanjiNamjaElf
PanjiNamjaElf / PyCharmIntelliJShared.md
Created April 3, 2025 12:01 — forked from vipulmathur/PyCharmIntelliJShared.md
Run PyCharm and IntelliJ IDEA on the same codebase

Problem

PyCharm and IntelliJ IDEA use the .idea directory to keep project information. While the two seem to be able to read each other's files, they (currently) don't understand the other's settings.

Solution

The work-around (till they learn to play better with each other) is to keep their .idea folders separate, while sharing a common project source tree. Instructions follow below.

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Gotten from the RedHat GPG migration manual

Backup the public and secret keyrings and trust database

## Export all public keys

gpg -a --export >mypubkeys.asc

@PanjiNamjaElf
PanjiNamjaElf / PowerShell Customization.md
Created August 18, 2024 15:11 — forked from jchandra74/PowerShell Customization.md
PowerShell, Cmder / ConEmu, Posh-Git, Oh-My-Posh, Powerline Customization

Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts

Backstory (TLDR)

I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization.

For my console needs, I am using Cmder which is based on ConEmu with PowerShell as my shell of choice.

Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu bash shell, check out this article by Scott Hanselman.

@PanjiNamjaElf
PanjiNamjaElf / ConsoleSchedulingTest.php
Created July 4, 2024 09:25 — forked from MattApril/ConsoleSchedulingTest.php
A simple way of testing that your Lumen commands are scheduled exactly when and how you expect. This approach does not trigger commands to actually execute, which is what a lot of other suggestions do.
<?php
use App\Console\Kernel;
use Carbon\Carbon;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Collection;
class ConsoleSchedulingTest extends TestCase
{
@PanjiNamjaElf
PanjiNamjaElf / nginx.conf
Created September 23, 2023 15:27 — forked from mreschke/nginx.conf
Nginx config for multiple laravel sites based on /api/v1 url paths
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route

Set the url with ?XDEBUG_SESSION_START=PHPSTORM and set a header Cookie: XDEBUG_SESSION=PHPSTORM

Set the url with ?XDEBUG_SESSION_START=PHPSTORM and set a header Cookie: XDEBUG_SESSION=PHPSTORM

@PanjiNamjaElf
PanjiNamjaElf / Foo.php
Created February 11, 2023 07:10 — forked from h-collector/Foo.php
Standalone Laravel Queue + Redis example
<?php
namespace Jobs;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Redis\Database as Redis;
class Foo extends Job
{
use InteractsWithQueue;
@PanjiNamjaElf
PanjiNamjaElf / gist:41bc81cc022e5931de2799f4e2766018
Created December 24, 2022 13:54 — forked from snowman-repos/gist:3817385
PHP: Check File Exists and Append Number
function file_newname($path, $filename){
if ($pos = strrpos($filename, '.')) {
$name = substr($filename, 0, $pos);
$ext = substr($filename, $pos);
} else {
$name = $filename;
}
$newpath = $path.'/'.$filename;
$newname = $filename;