Skip to content

Instantly share code, notes, and snippets.

View towry's full-sized avatar
🎯
Focusing

Towry Wang towry

🎯
Focusing
View GitHub Profile
/* Modify rendering of Logseq calculator:
- Overlay answers in calculator editor window;
- Disable line-wrapping in editor window (to preserve correspondence);
- Add feint ruling;
- Misc. cosmetic tweaks.
*/
:root {
--calculator-input-width: 68%;
@towry
towry / downloadWeappLinkPageData.js
Last active August 18, 2022 04:55
[油猴脚本] 下载小程序绑定的公众号数据.tampermonkey
// ==UserScript==
// @name DownloadWeappLinkPage
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 下载小程序绑定的公众号数据
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @author Towry Wang (github.com/towry)
// @match https://mp.weixin.qq.com/wxamp/basicprofile/relation?*
// @icon https://www.google.com/s2/favicons?sz=64&domain=qq.com
// @grant GM_notification
@towry
towry / qiniu.spec.ts
Created October 30, 2020 07:38
qiniu tool, imageMogr2
import { imageMogr2 } from "../qiniu";
describe("imageMogr2", () => {
it("should work with single parameter", () => {
const url =
"https://dn-odum9helk.qbox.me/resource/gogopher.jpg?imageMogr2/thumbnail/!20p&a=2";
const addMoreArg = "/rotate/200/quality/200";
expect(imageMogr2(url, addMoreArg)).toBe(
"https://dn-odum9helk.qbox.me/resource/gogopher.jpg?a=2&imageMogr2/thumbnail/!20p" +
@towry
towry / peakdet.m
Created December 14, 2019 03:40 — forked from endolith/peakdet.m
Peak detection in Python [Eli Billauer]
function [maxtab, mintab]=peakdet(v, delta, x)
%PEAKDET Detect peaks in a vector
% [MAXTAB, MINTAB] = PEAKDET(V, DELTA) finds the local
% maxima and minima ("peaks") in the vector V.
% MAXTAB and MINTAB consists of two columns. Column 1
% contains indices in V, and column 2 the found values.
%
% With [MAXTAB, MINTAB] = PEAKDET(V, DELTA, X) the indices
% in MAXTAB and MINTAB are replaced with the corresponding
% X-values.
@towry
towry / array.py
Created June 15, 2019 09:58
pythonic
a = np.array([[1,2,3],
[3,2,4]])
my_dict = {1:23, 2:34, 3:36, 4:45}
np.vectorize(my_dict.get)(a)
```
array([[23, 34, 36],
[36, 34, 45]])
```
@towry
towry / ServiceProvider.js
Last active April 21, 2019 13:47
Cerebraljs Service provider example, so we can inject cerebral provider into our application layer services, and use application layer services in cerebral application layer.
import { Provider } from 'cerebral';
const services = {};
export default Provider({
get(name, serviceModule) {
if (typeof name !== 'string') {
throw new TypeError("invalid name");
}
enable ---->
            updateShareOptions ---->
updateShareOptions ---->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.text {
text-shadow:
-1px -1px 0 #D83024,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.11.8/paper-full.min.js"></script>
<style id="jsbin-css">
.box {
width: 40px;
@towry
towry / 详细设计文档编写规范
Created March 1, 2018 01:57 — forked from stableShip/详细设计文档编写规范
详细设计文档编写规范
## 一.引言
### 1. 编写目的(阐明编写详细设计说明书的目的,指明读者对象。)
### 2. 项目背景(应包括项目的来源和主管部门等。)
### 3. 定义(列出文档中用到的专门术语定义和缩写词的原意。)
### 4. 参考资料(列出这些资料的作者、标题、编号、发表日期、出版单位或资料来源,可包括:(1)项目的计划任务书,合同或批文;(2)项目开发计划;(3)需求规格说明书;(3)概要设计说明书;(4)测试计划(初稿);(5)用户操作手册(初稿);(5)文档所引用的其他资料、软件开发标准或规范。)
## 二.总体设计
### 1.需求概述