This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Simple method which performs a login operation to Polish reddit-like "wykop.pl" | |
* and fetches the number of notifications. | |
* | |
* @todo This is made just for fun! My activity on the websites was too low to | |
* be granted access to Wykop API. | |
* | |
* @param string $operation token, login, notifs | |
* @param string $username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getStatus($num) { | |
$query = "curl 'https://tracking.inpost.pl/api/v1/history/package\[0\]=".$num."?_=".time()."' -H 'Origin: https://twoj.inpost.pl' -H 'Accept-Encoding: gzip, deflate, br' -H 'Accept-Language: pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36' -H 'Accept: */*' -H 'Referer: https://twoj.inpost.pl/pl/znajdz-przesylke?parcel=".$num."' -H 'Connection: keep-alive' --compressed 2>/dev/null"; | |
$data = shell_exec($query); | |
return json_decode($data, true); | |
} | |
function reportPackageInfo($num) { | |
$status = getStatus($num); | |
if (!$status || $status == 'Error') { | |
echo $num . ' -- brak' . PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$complexity = 1000000; | |
$decimals = 50; | |
bcscale($decimals); | |
$num = 0; | |
for ($i =0; $i < $complexity; $i++) { | |
$num = bcadd($num, bcdiv(pow(-1, $i), bcadd(1, bcmul(2, $i) ))); | |
} | |
echo bcmul(4, $num); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const BUMPER_FR = 23; | |
const BUMPER_FL = 24; | |
const BUMPER_RR = 22; | |
const BUMPER_RL = 25; | |
const E_R_F = 4; | |
const E_R_B = 1; | |
const E_L_F = 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
const BUMPER_FR = 23; | |
const BUMPER_FL = 24; | |
const BUMPER_RR = 22; | |
const BUMPER_RL = 25; | |
const E_R_F = 4; | |
const E_R_B = 1; | |
const E_L_F = 5; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Casadatos\Component\Downloader; | |
use Casadatos\Component\Downloader\Exception\HttpException; | |
use Zend\Http\Client; | |
use Zend\Http\Headers; | |
use Zend\Http\Request; | |
use Zend\Http\Response; | |
use Melihucar\FtpClient\FtpClient; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "vendor/autoload.php"; | |
include "Exception/HttpException.php"; | |
include "Downloader.php"; | |
$downloader = new Casadatos\Component\Downloader\Downloader(); | |
$headers = new Zend\Http\Headers(); | |
$headers->addHeaderLine("Accept-Encoding", "gzip") | |
->addHeaderLine("Content-Encoding", "gzip") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void echotest() { | |
cout << "echo out of class\r\n"; | |
} | |
class with_method_inside { | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function gen_one_to_three() { | |
for ($i = 1; $i <= 3; $i++) { | |
// Note that $i is preserved between yields. | |
echo "yielded $i\n"; | |
yield $i; | |
} | |
} | |
$generator = gen_one_to_three(); |