Skip to content

Instantly share code, notes, and snippets.

Pavel alg3rd

Block or report user

Report or block alg3rd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View perf
//Insta-perf-improvement for any #PHP codebase:
//replace `
foreach ($b as $a) { $c = array_merge($c, $a) }
// with
array_merge($c, [], ...$b)
View gist:cfd22edcaf1c2fca9d611093b646a34a
$string = 'string';
$double = 12.12345;
$array = ['foo', 'bar'];
$a = 555;
$b = 'ZZZ';
var_dump(@($a + $b));
var_dump($a . $b);
View SOLID&etc
[In reply to Moroshka]
Распишу по буквам, потом в совокупности
S - (SRP): (link wikipedia)
O - (Open/closed): (link wikipedia)
L - (Liskov):
View nginx_snippets
location ~/(admin|wp-admin|backend){
access_log off;
log_not_found off;
return 404;
View SSESymfonyExample
$response = new StreamedResponse(function () {
while (true) {
echo 'event: message' . PHP_EOL;
echo 'data: ' . \json_encode(['data' => 1]) . PHP_EOL;
View bootstrap.php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../app/autoload.php';
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('test', true);
try {
$container = $kernel->getContainer();
View syslog-ng-example
source s_nginx { udp(); };
#source s_nginx { file("/var/log/nginx/my-current/access.log"); };
filter f_local7 { facility(local7); };
destination d_loghost {tcp("" port(1500));};
#destination d_loghost {file("/tmp/access.log");};
log { source(s_nginx); filter(f_local7); destination(d_loghost); };
View lab2
#include <curses.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
View lab3
#include <semaphore.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <sys/mman.h>
You can’t perform that action at this time.