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 | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Auth; | |
use Illuminate\Support\Facades\Cookie; | |
use Illuminate\Support\Facades\Mail; | |
use Illuminate\Support\Facades\Session; | |
use Ratchet\WebSocket\Version\RFC6455\Connection; |
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
# Example for MySQL 5.7 how to use JOIN on 2 tables without junction table using new JSON column type. | |
# Let say we have 2 tables: posts and users | |
# Users may like posts | |
# We store the IDs of users who liked each post in posts.liked column which is a JSON array | |
# which might have a content like "[1, 2, 5, 10]" | |
SELECT posts.id AS post_id, users.id AS liked_by_user_id FROM posts JOIN users ON JSON_CONTAINS(posts.liked, CAST(users.id AS CHAR)) |
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
const $ = document.querySelector.bind(document) | |
// id | |
let divs = [ | |
$("#div"), | |
$("#input") | |
] | |
// class | |
let other = [ |
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 RatchetApp\Pusher; | |
require __DIR__ . '/../vendor/autoload.php'; | |
$loop = React\EventLoop\Factory::create(); | |
$pusher = new Pusher(); | |
$loop->addPeriodicTimer(10, array($pusher, 'timedCallback')); |