Skip to content

Instantly share code, notes, and snippets.

View Kocal's full-sized avatar

Hugo Alliaume Kocal

View GitHub Profile
( ͡° ͜ʖ ͡°)
@Kocal
Kocal / TwitchWebSocket.js
Created November 12, 2017 21:03
Non-tested class for Twitch API WebSocket
class TwitchWebSocket {
constructor() {
this.lastPingTimestamp = null;
this.lastPongTimestamp = null;
this.pingInterval = null;
this.pongTimeout = null;
this.init();
}
init() {
http://sokra.github.io/source-map-visualization/#base64,KGZ1bmN0aW9uKGUpe3ZhciByPXt9O2Z1bmN0aW9uIHQobil7aWYocltuXSlyZXR1cm4gcltuXS5leHBvcnRzO3ZhciBvPXJbbl09e2k6bixsOiExLGV4cG9ydHM6e319O3JldHVybiBlW25dLmNhbGwoby5leHBvcnRzLG8sby5leHBvcnRzLHQpLG8ubD0hMCxvLmV4cG9ydHN9dC5tPWUsdC5jPXIsdC5kPWZ1bmN0aW9uKGUscixuKXt0Lm8oZSxyKXx8T2JqZWN0LmRlZmluZVByb3BlcnR5KGUscix7ZW51bWVyYWJsZTohMCxnZXQ6bn0pfSx0LnI9ZnVuY3Rpb24oZSl7InVuZGVmaW5lZCIhPT10eXBlb2YgU3ltYm9sJiZTeW1ib2wudG9TdHJpbmdUYWcmJk9iamVjdC5kZWZpbmVQcm9wZXJ0eShlLFN5bWJvbC50b1N0cmluZ1RhZyx7dmFsdWU6Ik1vZHVsZSJ9KSxPYmplY3QuZGVmaW5lUHJvcGVydHkoZSwiX19lc01vZHVsZSIse3ZhbHVlOiEwfSl9LHQudD1mdW5jdGlvbihlLHIpe2lmKDEmciYmKGU9dChlKSksOCZyKXJldHVybiBlO2lmKDQmciYmIm9iamVjdCI9PT10eXBlb2YgZSYmZSYmZS5fX2VzTW9kdWxlKXJldHVybiBlO3ZhciBuPU9iamVjdC5jcmVhdGUobnVsbCk7aWYodC5yKG4pLE9iamVjdC5kZWZpbmVQcm9wZXJ0eShuLCJkZWZhdWx0Iix7ZW51bWVyYWJsZTohMCx2YWx1ZTplfSksMiZyJiYic3RyaW5nIiE9dHlwZW9mIGUpZm9yKHZhciBvIGluIGUpdC5kKG4sbyxmdW5jdGlvbihyKXtyZXR1cm4gZVtyXX0uYmluZChudWxsLG8pKTtyZXR1cm4gbn0sdC5uPWZ1bmN0
@Kocal
Kocal / MergeNonICUAndICUTranslations.php
Last active June 14, 2024 20:21
One-shot command that helped me to migrate non-ICU translations to ICU translations, and merge them with original ICU translations, inside a Symfony project. You must copy your `translations` folder to `translations.original` before running the command.
<?php
namespace App\Command\Tools;
use App\Core\Entity\Website\Locale;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
# ...
FROM dunglas/frankenphp:1-alpine AS frankenphp_upstream
FROM frankenphp_upstream AS frankenphp_base
RUN apk add --no-cache \
autoconf \
pkgconfig \
g++ \
make \

Keybase proof

I hereby claim:

  • I am kocal on github.
  • I am hugoalliaume (https://keybase.io/hugoalliaume) on keybase.
  • I have a public key ASCTdAl8FyWWkQ6-G3fuiwvPeW4S2wCogBFyxWzHyQor9wo

To claim this, I am signing this object: