robb0wen/tornis — скрипт помогает вам наблюдать и реагировать на изменения в окне просмотра вашего браузера

robb0wen/tornis -  скрипт помогает вам наблюдать и реагировать на изменения в окне просмотра вашего браузера

// import the Tornis store functions
import { 
  watchViewport, 
  unwatchViewport, 
  getViewportState
} from 'tornis';

// define a watched function, to be run on each update
const updateValues = ({ size, scroll, mouse, orientation }) => {
  if (size.changed) {
    // do something related to size
  }
  
  if (scroll.changed) {
    // do something related to scroll position or velocity
  }

  if (mouse.changed) {
    // do something related to mouse position or velocity
  }
};

// bind the watch function
// By default this will run the function as it is added to the watch list
watchViewport(updateValues);

// to bind the watch function without calling it
watchViewport(updateValues, false);

// when you want to stop updating
unwatchViewport(updateValues);

// to get a snapshot of the current viewport state
const state = getViewportState();

https://github.com/robb0wen/tornis

terrylinooo/shieldon — защита от кучи запросов к сайту

terrylinooo/shieldon - защита от кучи запросов к сайту

Когда пользователи или роботы пытаются просмотреть множество ваших веб-страниц за короткий промежуток времени, их временно банят. Получить разбан можно, пройдя капчу.

$shieldon = new \\Shieldon\\Shieldon();

// Use SQLite as the data driver.
$dbLocation = APPPATH . 'cache/shieldon.sqlite3';
$pdoInstance = new \\PDO('sqlite:' . $dbLocation);
$shieldon->setDriver(new \\Shieldon\\Driver\\SqliteDriver($pdoInstance));

// Set components.
// This component will only allow popular search engine.
// Other bots will go into the checking process.
$shieldon->setComponent(new \\Shieldon\\Component\\TrustedBot());

// You can ignore this setting if you only use one Shieldon on your web application. This is for multiple instances.
$shieldon->setChannel('web_project');

// Only allow 10 sessions to view current page.
// The default expire time is 300 seconds.
$shieldon->limitSession(10);

// Set a Captcha servie. For example: Google recaptcha.
$shieldon->setCaptcha(new \\Shieldon\\Captcha\\Recaptcha([
    'key' => '6LfkOaUUAAAAAH-AlTz3hRQ25SK8kZKb2hDRSwz9',
    'secret' => '6LfkOaUUAAAAAJddZ6k-1j4hZC1rOqYZ9gLm0WQh',
]));

// Start protecting your website!

$result = $shieldon->run();


if ($result !== $shieldon::RESPONSE_ALLOW) {
    if ($shieldon->captchaResponse()) {

        // Unban current session.
        $shieldon->unban();
    }
    // Output the result page with HTTP status code 200.
    $shieldon->output(200);
}

https://github.com/terrylinooo/shieldon

remotelyliving/php-dns — DNS абстракция в PHP

$resolver = new Resolvers\\GoogleDNS();
$hostname = 'google.com';

// can query via convenience methods
$records = $resolver->getARecords($hostname); // returns a collection of DNS A Records

// can also query by any RecordType. Record Types are a proper object that validate you have the right type.
$recordType = DNSRecordType::createAAAA();

// OR

$recordType = DNSRecordType::TYPE_AAAA;

$moreRecords = $resolver->getRecords($hostname, $recordType);

// can query to see if any resolvers find a record or type.
$resolver->hasRecordType($hostname, $type) // true | false
$resolver->hasRecord($record) // true | false

// This becomes very powerful when used with the Chain Resolver

https://github.com/remotelyliving/php-dns

azdanov/php-interview-exercises — репозиторий с заданиями на интервью по PHP

<?php
declare(strict_types=1);
namespace Exercises\\FizzBuzz;
/**
 * Print numbers from 1 to n.
 * When n is divisible by 3 echo 'fizz'.
 * When n is divisible by 5 echo 'buzz.
 * When n is divisible by both 3 and 5 echo 'fizzbuzz'.
 *
 * @method static void print(int $limit)
 * @example FizzBuzz::print('5') -> 1, 2, 'fizz', 4, 'buzz'
 */
final class FizzBuzz
{
}

<?php
declare(strict_types=1);
namespace Exercises\\FizzBuzz\\Complete;
final class FizzBuzzComplete
{
    public static function print(int $limit): void
    {
        for ($i = 1; $i <= $limit; ++$i) {
            $word = '';
            if ($i % 3 === 0) {
                $word .= 'fizz';
            }
            if ($i % 5 === 0) {
                $word .= 'buzz';
            }
            echo $word ?: $i;
        }
    }
}

https://github.com/azdanov/php-interview-exercises

bernardphp/bernard — PHP-библиотека для создания фоновых заданий для последующей обработки

Поддерживает
— Predis / PhpRedis
-Amazon SQS
— Iron MQ
— Doctrine DBAL
— Pheanstalk
— PhpAmqp / RabbitMQ
— Queue interop

<?php

use Bernard\\Driver\\Predis\\Driver;
use Predis\\Client;

$predis = new Client('tcp://localhost', array(
    'prefix' => 'bernard:',
));

$driver = new Driver($predis);

Запуск

$ php ./example/predis.php consume
$ php ./example/predis.php produce

https://github.com/bernardphp/bernard

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. ...
  12. 226
Scroll Up