Skip to content

Instantly share code, notes, and snippets.

View kefzce's full-sized avatar
🏠
Working from home

kefzce

🏠
Working from home
View GitHub Profile
@fesor
fesor / README.md
Last active November 3, 2023 06:50
What is OOP

Что такое ООП

Ссылки на материалы, позволяющее лучше понять оригинальную идею.

Quotes

Java and C++ make you think that the new ideas are like the old ones. Java is the most distressing thing to hit computing since MS-DOS.

Alan Kay

@fesor
fesor / README.md
Created July 25, 2018 12:28
Symfony without ORM

Удобный менеджмент миграций с Symfony и Doctrine

Мало кто знает, но что бы работал migration:diff вам не нужно ставить ORM.

Что бы это работало объявим простой сервис:

<?php
@fesor
fesor / ContainerReturnTypePlugin.php
Last active July 28, 2022 13:50
Phan plugins for Symfony and Doctrine
<?php
use Phan\CodeBase;
use Phan\Language\Context;
use Phan\Language\UnionType;
use Phan\PluginV2\ReturnTypeOverrideCapability;
use Phan\Language\Element\Method;
use Phan\PluginV2;
use \Phan\Language\FQSEN\FullyQualifiedClassName;
use Phan\Language\Element\Clazz;
1. Почему вы выбрали именно нашу компанию?
Вы идиот (ка), да? Я, как и все кандидаты до меня и после меня, направил резюме в десяток мест.
Где устроюсь быстрее и выгоднее — там и хорошо.
2. Как вы считаете, почему мы должны выбрать именно вас?
Вам работники вообще нужны? Ну вот он я. Работник.
Именно меня стоит выбрать хотя бы потому, что я явно умнее всех тех, кто заливал на эти вопросы стандартную чушь.
И умнее вас, между прочим, потому что я никогда таких дурацких вопросов бы не задал.
@archy-bold
archy-bold / ExamplePassportTest.php
Last active October 15, 2022 03:49
Testing Passport Authenticated Controllers and Routes in Laravel
<?php
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ExamplePassportTest extends \PassportTestCase
{
use DatabaseTransactions;
@jonlabelle
jonlabelle / async_await_best_practices_cheatsheet.md
Last active May 12, 2024 03:58
C# Asynchronous Programming Guideline Cheat Sheet

Async Await Best Practices Cheat Sheet

Summary of Asynchronous Programming Guidelines

Name Description Exceptions
Avoid async void Prefer async Task methods over async void methods Event handlers
Async all the way Don't mix blocking and async code Console main method
Configure context Use ConfigureAwait(false) when you can Methods that require con­text
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't: