Skip to content

Instantly share code, notes, and snippets.

View mebusw's full-sized avatar

Jacky Shen mebusw

View GitHub Profile
@mebusw
mebusw / balance wheel.html
Last active September 7, 2020 05:22
echart.js to draw balance wheel. See also https://jsfiddle.net/y93u7v6L/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ECharts</title>
<!-- 引入 echarts.js -->
<script src="https://cdn.jsdelivr.net/npm/echarts@4.8.0/dist/echarts.min.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
@mebusw
mebusw / liking.js
Last active March 12, 2020 07:55
Liking componet for Tencent coding on UPerform website https://www.uperform.cn/tencent-coding-agile-devops-tools/
<script>
console.log("like")
function refresh_like() {
$.get("https://operation.coding.net/api/v1/cooperation/like", function(res){
if (res.code === 0) {
$("#liking-1").html(res.data.list[2].like)
$("#liking-2").html(res.data.list[3].like)
$("#liking-3").html(res.data.list[0].like)
}
@mebusw
mebusw / wordpress-top-bar.js
Last active March 11, 2020 14:41
customized autosizing top bar in Wordpress with beTheme
/* here's the customized CSS
@media only screen and (min-width: 768px) {
#mfn-rev-slider {
margin-top:70px;
}
}
@media only screen and (max-width: 767px) {
#mfn-rev-slider {
<?php get_header(); ?>
<?php header('Content-type: text/html; charset=utf-8'); ?>
<h1>WP API with nouces</h1>
<?php
$jarr=array(
'root' => esc_url_raw( rest_url() ),
'nonce' => wp_create_nonce( 'wp_rest' )
@mebusw
mebusw / gist:bbeffe870ea3259aacd9f3577ba08121
Created March 28, 2018 03:53
crontab for wordpress site, note sometimes env variables need to be explicitly specified so run the cronjob properly
*/20 * * * * /usr/sbin/ntpdate pool.ntp.org > /dev/null 2>&1
*/15 * * * * wget -q -O �C http://www.uperform.cn//wp-cron.php?doing_wp_cron >/dev/null 2>&1
* * * * * source /etc/profile;/bin/sh /root/healthcheck-php-mysql.sh > /dev/null 2>&1
@mebusw
mebusw / wp-posts.php
Last active May 13, 2022 09:00
loop posts of wordpress into json array
<?php //get_header(); ?>
<?php header('Content-type: text/json; charset=utf-8'); ?>
<?php
/*
$jarr=array(
'total' => 239,
'list' => array(
array(
'code'=>'001',
@mebusw
mebusw / CpsRegex.fsx
Last active August 31, 2017 10:02 — forked from yuanmai/CpsRegex.fsx
用 CPS 实现字符串匹配。基于讲座 https://youtu.be/cnhb4M8-J5M
type Re =
| Lit of char
| Seq of Re * Re
| Or of Re * Re
| Star of Re
let rec match2 (re: Re) (str: char list) k =
match re with
| Lit(c) -> match str with
| [] -> false
#!encoding=utf8
"""变形金刚的对战,看具体描述:https://coding.net/u/wanghao/p/The-Transformation-Company/git/blob/master/README.md
变形金刚的对战。
每个变形金刚(Transformer包括Autobot和Decepticon)都有以下的技术参数 参看大黄蜂的例子: http://www.ntfa.net/ntfa/techspecs/index.php?cat=Gen1&group=AutoAN&char=Bumblebee )
力量 (Strength)
智慧 (Intelligence)
#!encoding=utf8
"""
建立在山峰和峡谷的城堡酒店,看具体描述:https://coding.net/u/wanghao/p/The-Castle-Company/git/blob/master/README.md
建立在山峰和峡谷的城堡酒店
给定一组整数数组,可以把它们想象成高度,如[3,2,5,6,7,5,3]从而形成一条地形数据。
要求:找到所有的峰值和谷值的总数,所谓峰值就是他之前的数字和之后的数字都比他小,谷值就是之前和之后的数字都比他大。
如 [2,4,3]中 4 可以记为一个峰值, [5,3,6]中3可以记为一个谷值,这个峰/谷值可以是一个数或者一系列相同的数,如 [3,5,5,5,4] 三个 5 可以看作是一个峰值。