This file contains 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 | |
// app/Http/Controllers/TutoringController.php | |
use App\Models\Student; | |
use Illuminate\Http\Request; | |
class TutoringController extends Controller | |
{ | |
public function updateRecommendations(Student $student) |
This file contains 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 | |
Co::set(['hook_flags' => SWOOLE_HOOK_TCP]); | |
Co\run(function() | |
{ | |
// refresh | |
$redis0 = new Redis(); | |
$redis0->connect('127.0.0.1', 6379); | |
$redis0->flushDB(); |
This file contains 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 | |
/** | |
* Extracted from https://github.com/openswoole/swoole-src/blob/f191c0b0a98e9b97f5c81d4877f450c863e6c36d/ext-src/php_swoole_library.h#L6999 | |
* | |
* Changes: | |
* | |
* - Added 'service' label | |
* - Added additional label support | |
* |
This file contains 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 | |
/** | |
Give the data is this: | |
[ | |
{ | |
"name":"Joe", | |
"meetings":[ |
This file contains 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 | |
Co\run(function() { | |
go(function() { | |
echo "==========================================" . PHP_EOL; | |
echo file_get_contents('http://localhost:8282/requestA') . PHP_EOL; | |
echo "==========================================" . PHP_EOL; | |
}); |
This file contains 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 | |
Co\run(function() { | |
go(function () { | |
var_dump(file_get_contents('http://localhost:9502/requestA')); | |
}); | |
go(function () { | |
var_dump(file_get_contents('http://localhost:9502/requestB')); |
This file contains 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
<script> | |
let ws = new WebSocket('ws://127.0.0.1:9502'); | |
ws.send("test 1"); | |
setTimeout(() => ws.send("test 2"), 2000); | |
</script> |
This file contains 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
#!/usr/bin/env php | |
<?php | |
declare(strict_types=1); | |
class DataObject | |
{ | |
public $total = 0; | |
public $data = []; | |
public function push($item) |
This file contains 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
FROM ubuntu:20.04 | |
ARG WWWGROUP | |
ARG SUPERVISOR_CONF | |
WORKDIR /var/www/html | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV TZ=UTC |
This file contains 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 | |
use Swoole\Websocket\Server; | |
use Swoole\Http\Request; | |
use Swoole\WebSocket\Frame; | |
$server = new Server("0.0.0.0", 9501); | |
$server->table = (require __DIR__ . DIRECTORY_SEPARATOR . 'user-table.php')(); | |
$server->on("start", function (Server $server) { |
NewerOlder