Skip to content

Instantly share code, notes, and snippets.

@sunxyw
sunxyw / Dockerfile.prod
Created February 27, 2023 16:35
Zhamao Framework Production Dockerfile
FROM phpswoole/swoole:latest as pack
RUN echo "phar.readonly=0" >> /usr/local/etc/php/conf.d/docker-php-ext-phar.ini
WORKDIR /app
COPY . .
RUN composer install --no-dev --optimize-autoloader --no-interaction --no-progress
RUN mkdir -p /app/build && /app/zhamao build --build-dir=/app/build --target=zm.phar --quiet
FROM alpine:latest as build
ADD https://dl.zhamao.xin/php-bin/file/micro-8.1.8-x86_64.tar.gz /tmp
RUN tar -zxvf /tmp/micro-8.1.8-x86_64.tar.gz -C /tmp
@sunxyw
sunxyw / i18n.yml
Last active May 23, 2022 09:13
Upptime 中文汉化
activeIncidents: 活动事件
allSystemsOperational: 所有系统工作正常
incidentReport: "$NUMBER 号事件报告 →"
activeIncidentSummary: 于 $DATE 打开,包括 $POSTS 个帖子
incidentTitle: $NUMBER 号事件详情
incidentDetails: 事件详情
incidentFixed: 已修复
incidentOngoing: 进行中
incidentOpenedAt: 打开于
incidentClosedAt: 关闭于
@sunxyw
sunxyw / replace-string-in-html.php
Last active April 15, 2022 08:16
处理 HTML 中的字符串,并原样输出
<?php
$text = <<<'EOT'
<img class="bili-avatar-img" alt="这是ALT里边的文字">
我在外边Outside欸嘿
<span class="bili-avatar-icon bili-avatar-size-60">
这是一串文字欸文字Inside</span>
EOT;
$no_tags_text = preg_replace('/<.*?>/m', '', $text);
<?php
$db = mysqli_connect("localhost", "phpuser", "alm65z", "phpdb");
function sess_open($sess_path, $sess_name) {
return true;
}
function sess_close() {
return true;
}
@sunxyw
sunxyw / cloudSettings
Last active May 18, 2020 04:10
VSCode 插件配置同步
{"lastUpload":"2020-04-02T09:29:06.893Z","extensionVersion":"v3.4.3"}