Skip to content

Instantly share code, notes, and snippets.

@Eczbek
Eczbek / as.hpp
Last active May 22, 2026 23:01
as
#include<concepts>
#include<utility>
struct as{template<class T>operator T(){std::unreachable();};template<class T>struct x{T&&x;template<class U>[[nodiscard]]constexpr decltype(static_cast<U>((T&&)x))operator->*(U(as::*)())noexcept(noexcept(static_cast<U>((T&&)x))){return static_cast<U>((T&&)x);}};};constexpr auto operator->*(auto&&x,std::same_as<as>auto)noexcept{return as::x<decltype(x)>((decltype(x))x);}
#define as ->*::as()->*&::as::operator
@Jengas
Jengas / index.php
Last active May 4, 2026 12:07
Discord oauth2 example PHP
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('max_execution_time', 300); //300 seconds = 5 minutes. In case if your CURL is slow and is loading too much (Can be IPv6 problem)
error_reporting(E_ALL);
define('OAUTH2_CLIENT_ID', '1234567890');
define('OAUTH2_CLIENT_SECRET', 'verysecretclientcode');