Skip to content

Instantly share code, notes, and snippets.

@MakStashkevich
MakStashkevich / telegram_web_app_bot_validate_hash.php
Created May 12, 2022 16:21
Telegram Web App Bot (Validate hash) on PHP
<?php
$bot_token = '0123456789:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$data_check_string = 'XXX'; // get from Telegram.WebAppData
$data_check_arr = explode('&', rawurldecode($data_check_string));
$needle = 'hash=';
$check_hash = FALSE;
foreach($data_check_arr AS &$val){
# Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
# 1. create the group
sudo groupadd docker
# 2. add user to group
sudo usermod -aG docker ${USER}
# 3. to apply changes, log in and out
sudo su

Тестовое задание для PHP разработчика

Предисловие

Уважаемые соискатели, уважайте свое время и время программиста, проверяющего вашу работу. Если так получилось, что вы не можете (не успеваете\не хотите) выполнить задание до конца - сообщите пожалуйста об этом HR. Проверьте пожалуйста работоспособность вашего проекта (чек-лист проверки).

Подойдите пожалуйста к исполнению задания максимально усердно. Продумайте архитектуру проекта, используйте "плюшки" фреймворка, которые сделают ваш код качественным. Максимально хорошо организуйте код. Если можно что то вынести в сервисный слой - выносите, если можно где то использовать eloquent scopes - используйте (думаю, что вы поняли. Знаете как показать свои знания - показывайте). Напишите свой код так, чтобы не стыдно было показать другим.

Не забывайте, что мне необходимо по этому, крайне небольшому, заданию оценить ваши знания. Я хочу увидеть production ready сервис, который вы можете запустить в работу прямо сейчас.

А далее у нас та

Step 1: Combine All Certificates into a Single File
You should have received your SSL certificate via email in the form of a .zip file. Once you download and extract the file, you will see it consists of a server certificate, a root certificate, and an intermediate certificate.
The first step is to combine all three files into one.
diagram showing Combines certificates into a single SSL bundle file
You can do this manually, by copying and pasting the content of each file in a text editor and saving the new file under the name ssl-bundle.crt.
@arthursalvtr
arthursalvtr / add-custom-mail-driver-to-laravel.md
Last active April 5, 2024 17:43
Add Custom Mail Driver to Laravel

How to add custom Mail Driver to Laravel

Tested on Laravel 5.8

Within the source code of laravel 5.8 at this time of writing, we have this following

<?php

namespace Illuminate\Support;
@kenmori
kenmori / error Your lockfile.md
Last active February 26, 2025 14:31
error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`

error Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.

if you update your package.json only. and then run yarn install --frozen-lockfile

The above error show you on console.

it's say that you need to run just yarn install.

@MauricioMoraes
MauricioMoraes / access_postgresql_with_docker.md
Last active June 30, 2025 18:17
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@simonhamp
simonhamp / AppServiceProvider.php
Last active May 20, 2025 18:33
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
<?php
$key = $_ENV['key'];
$sec = $_ENV['sec'];
$account = $_ENV['account'];
$post_request = array(
"post_uri" => "https://api.calltrackingmetrics.com/api/v1/accounts/$account/webhooks"
);