Skip to content

Instantly share code, notes, and snippets.

@NHZEX
NHZEX / base94.c
Created May 29, 2018 03:40 — forked from iso2022jp/base94.c
base94 encoder/decoder
#include "base94.h"
void base94_encode(const unsigned char *plain, unsigned char *code) {
// high * 2^64 | low
unsigned long long value
= ((unsigned long long)plain[1] << 56) | ((unsigned long long)plain[2] << 48)
| ((unsigned long long)plain[3] << 40) | ((unsigned long long)plain[4] << 32)
@NHZEX
NHZEX / gist:1f794d4a1ce4228e2e74ed732ade77ca
Created July 28, 2018 05:42
判断字符串是否二进制
function isBinary($str) {
return mb_check_encoding($str, 'UTF-8');
}
let submit = function(target) {
// 表单校验
that.gFormItem = that.findInputs(form);
if (that.isAllpass(that.gFormItem)) {
// 提前定位,防止提示被遮挡
that.focus(target);
that.passCall.call(that, form, target);
}
};
// 一级截取
@NHZEX
NHZEX / SnowFlake.php
Last active May 31, 2019 11:05
SnowFlake 初版
<?php
/**
* Created by PhpStorm.
* User: Auoor
* Date: 2019/3/14
* Time: 20:41
*/
declare(strict_types=1);
namespace SnowFlake;
@NHZEX
NHZEX / WebSocketClient
Created May 11, 2019 09:29
Swoole WebSocket Client
<?php
use Exception;
use Swoole\Client;
use Swoole\WebSocket\Server;
// https://github.com/swoole/swoole-src/blob/master/examples/websocket/WebSocketClient.php
class WebSocketClient
{
const VERSION = '0.1.4';
$ composer require nhzex/tp-swoole @dev -vvv --ignore-platform-reqs
```josn
"repositories": {
"local-package": {
"type": "path",
"url": "../package/"
},
}
```
@NHZEX
NHZEX / test
Created October 9, 2019 03:11
pool test
<?php
# composer require nhzex/zsw-core
use Swoole\Runtime;
use unzxin\zswCore\Process\BaseSubProcess;
use unzxin\zswCore\ProcessPool;
use function HuangZx\ref_get_prop;
require_once __DIR__ . '/../vendor/autoload.php';
@NHZEX
NHZEX / IDEA 文件头注解清理正则
Last active April 22, 2020 01:46
IDEA 文件头注解清理正则
\/\*\*
\* Created by \S+?\.
\* User: \S+?
\* Date: \S+?
\* Time: \S+?
\*\/\s
- java.net.BindException: Address already in use: bind
https://youtrack.jetbrains.com/issue/IDEA-238995
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009005139/comments/360002524640
```
net stop winnat
net start winnat
```
@NHZEX
NHZEX / .phpstorm.meta.php
Created October 7, 2021 16:54
imi ide helper
<?php
namespace PHPSTORM_META {
override(\Imi\App::getBean(0), map([
'' => '@',
'FileCache' => Imi\Cache\Handler\File::class,
'RedisCache' => Imi\Cache\Handler\Redis::class,
'RedisHashCache' => Imi\Cache\Handler\RedisHash::class,
'DefaultRuntimeModeHandler' => Imi\Core\Runtime\Handler\DefaultRuntimeModeHandler::class,
'CronCalculator' => Imi\Cron\CronCalculator::class,