Skip to content

Instantly share code, notes, and snippets.

View towry's full-sized avatar
🎯
Focusing

Towry Wang towry

🎯
Focusing
  • Shanghai
View GitHub Profile
/* fonts
* ===============================*/
@import url('https://fonts.loli.net/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,600;1,700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont/style.css');
@font-face {
font-family: "Only Emoji";
src: local("Apple Color Emoji"), local("Android Emoji"), local("Segoe UI Emoji"), local("Segoe UI");
unicode-range: U+200D, U+2049, U+20E3, U+2117, U+2120, U+2122, U+2139, U+2194-2199, U+21A9, U+21AA, U+229C, U+231A, U+231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FE, U+24C2, U+25A1, U+25AA-25AD, U+25B6, U+25C0, U+25D0, U+25D1, U+25E7-25EA, U+25ED, U+25EE, U+25FB-25FE, U+2600-2605, U+260E, U+2611, U+2614, U+2615, U+2618, U+261D, U+2620, U+2622, U+2623, U+2626, U+262A, U+262E, U+262F, U+2638-263A, U+2640, U+2642, U+2648-2653, U+265F, U+2660, U+2663, U+2665, U+2666, U+2668, U+267B, U+267E, U+267F, U+2691-2697, U+2699, U+269B, U+269C, U+26A0, U+26A1, U+26A7, U+26AA, U+26AB, U+26B0, U+26B1, U+26BD, U+26BE, U+26C4,
/* 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;