Skip to content

Instantly share code, notes, and snippets.

View yangweijie's full-sized avatar
🎯
Focusing

jay yangweijie

🎯
Focusing
View GitHub Profile
@yangweijie
yangweijie / ocp.php
Created February 20, 2024 05:08 — forked from ck-on/ocp.php
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@yangweijie
yangweijie / Crack Sublime Text | Windows and Linux
Created September 7, 2020 01:23 — forked from JerryLokjianming/Crack Sublime Text Windows and Linux.md
Crack Sublime Text 3.2.2 Build 3211 and Sublime Text 4 Alpha 4081 with Hex
# Subscribe to my YouTube Channel -> https://lokjianming.page.link/CVLm #
# Blog -> https://jerrylokjianming.github.io/ #
How to Crack Sublime Text 3.2.2 Build 3211 with Hex Editor (without license) ↓
1. Download & Install Sublime Text 3.2.2 Build 3211
2. Visit <https://hexed.it/>
3. Open file select sublime_text.exe
4. Offset 0x8545: Original 84 -> 85
5. Offset 0x08FF19: Original 75 -> EB
@yangweijie
yangweijie / network.php
Created December 15, 2017 02:45
get network type from phone useragent in wechat or alipay
// 获取微信或者支付宝里的网络类型
if(!function_exists('getNetWorkStatus')){
function getNetWorkStatus(){
$agent = $_SERVER['HTTP_USER_AGENT'];
// $agent = 'Mozilla/5.0 (Linux; Android 7.0; MI 5 Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043622 Safari/537.36 MicroMessenger/6.5.23.1180 NetType/WIFI Language/zh_CN';
if (stripos($agent, 'MicroMessenger')!==false){
$type = '微信';
$start = stripos($agent, 'NetType/');
if(false !== $start){
$end = stripos($agent, ' Language');
@yangweijie
yangweijie / gist:ba8daab419cb0de4335991859b33abc1
Created October 17, 2017 06:48
php:tp5 cross-doamin header
if ($response instanceof Json || request()->type() == 'json') {
$response->header('Access-Control-Allow-Origin', '*')
->header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE')
->header('Access-Control-Allow-Headers', 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');
}
@yangweijie
yangweijie / functions.php
Created July 26, 2017 03:06
php:thinkphp3 E encoding
/**
* 抛出异常处理
* @param string $msg 异常消息
* @param integer $code 异常代码 默认为0
* @return void
*/
function E($msg, $code=0) {
$msg = iconv('GB2312', 'UTF-8', $msg);
throw new Think\Exception($msg, $code);
}
@yangweijie
yangweijie / Purchase.php
Last active July 24, 2017 07:40
php:sprintf_0001
$var = sprintf('%04d', 2);//生成4位数,不足前面补0
echo $var;//结果为0002
@yangweijie
yangweijie / js_exception.html
Last active August 29, 2015 14:06
js exception.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<!-- localStorage -->
<script type="text/javascript" src="js/localstorage.js">
</script>
<script>
window.onerror = function(msg, url, line)
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-menu-button/core-menu-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-icon-button/paper-icon-button.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
@yangweijie
yangweijie / about_min.js
Created April 11, 2014 06:05
js:about_min
//120 to 两小时0分
function (min) {
return (min/60>>0)+'小时'+(min%60)+'分钟';
};
@yangweijie
yangweijie / strrepeat.js
Created April 3, 2014 01:41
js:strrepeat
function str_repeat(len, str){
return new Array(len).join(str);
}