Skip to content

Instantly share code, notes, and snippets.

View pengx17's full-sized avatar
🛫

Peng Xiao pengx17

🛫
View GitHub Profile
@pengx17
pengx17 / markdown_here.css
Last active December 19, 2015 16:19
My customized Markdown Here Styling
/*
* NOTE:
* - The use of browser-specific styles (-moz-, -webkit-) should be avoided.
* If used, they may not render correctly for people reading the email in
* a different browser than the one from which the email was sent.
* - The use of state-dependent styles (like a:hover) don't work because they
* don't match at the time the styles are made explicit. (In email, styles
* must be explicitly applied to all elements -- stylesheets get stripped.)
*/
@pengx17
pengx17 / debounce-promise.js
Last active May 3, 2021 20:17
Like lodash.debounce, but multiple calls to a debounced function will return the same promise so that they will be notified when the debounced function returns.
// Debounced promise:
// Like lodash.debounce, but multiple calls to a debounced function
// will return the same promise so that they will be notified when the debounced function returns
//
// In case the deboucned value is a promise, the last promise value shall be returned.
function debounceFn(fn, timeout) {
let timer = undefined;
let resPromise = undefined;
let resolver = undefined;
let rejector = undefined;
const { get, post } = require("axios");
const url = `https://sc.ftqq.com/SCU15511Ta62845f53fed1f23c365071e0e1bda035a029f383eba8.send`;
const getParams = (text, desp) => encodeURI(`?text=${text}&desp=${desp}`);
async function getBeijingStores() {
const res = await get(
"https://reserve-prime.apple.com/CN/zh_CN/reserve/iPhone/stores.json"
);
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gist.githubusercontent.com/pengx17/bba5e7d5b25fcdd143673cb0df9c0b93/raw/ad8bec658dcc44904cf908acc5a525148f7ad4ec/app-nav-config-category.json",
"type": "object",
"title": "Rubick App Nav Config",
"required": [
"user"
],
"properties": {
"user": {
@pengx17
pengx17 / kubernetes-schema-all.json
Last active November 15, 2018 14:43
kubernetes-schema-all.json
{
"oneOf": [
{
"$ref": "https://gist.githubusercontent.com/pengx17/0ce785e18739f3421c95ee7bf833e37f/raw/ac3783b7416196309eabb46c846748e6043c9060/_definitions.json#/definitions/io.k8s.kubernetes.pkg.apis.authorization.v1.NonResourceAttributes"
},
{
"$ref": "https://gist.githubusercontent.com/pengx17/0ce785e18739f3421c95ee7bf833e37f/raw/ac3783b7416196309eabb46c846748e6043c9060/_definitions.json#/definitions/com.github.openshift.origin.pkg.image.apis.image.v1.ImageStreamList"
},
{
"$ref": "https://gist.githubusercontent.com/pengx17/0ce785e18739f3421c95ee7bf833e37f/raw/ac3783b7416196309eabb46c846748e6043c9060/_definitions.json#/definitions/io.k8s.kubernetes.pkg.api.v1.AzureDiskVolumeSource"
@pengx17
pengx17 / _definitions.json
Created November 15, 2018 14:41
_definitions.json
{
"definitions": {
"io.k8s.kubernetes.pkg.api.v1.NodeDaemonEndpoints": {
"description": "NodeDaemonEndpoints lists ports opened by daemons running on the Node.",
"properties": {
"kubeletEndpoint": {
"$ref": "#/definitions/io.k8s.kubernetes.pkg.api.v1.DaemonEndpoint",
"description": "Endpoint on which Kubelet is listening."
}
},
@pengx17
pengx17 / 肖富贵起名器.ts
Created September 26, 2019 12:36
肖富贵起名器
import { request } from 'gaxios';
import * as cheerio from 'cheerio';
import { promises } from 'fs';
const base = 'http://v.8s8s.com';
async function getNameList(): Promise<[string, string][]> {
const page = await request<string>({
url: base + '/qumingzi_5.php',
@pengx17
pengx17 / riphook.ts
Last active October 15, 2019 03:25
Wrap a hook and return a component, see https://stackblitz.com/edit/ripook-demo?file=index.tsx
import React, { useMemo, useEffect } from 'react';
type Func<Args extends any[], Return> = (...args: Args) => Return;
/**
* Wrap a hook and return a component
*/
export function ripook<Args extends any[], Return>(hook: Func<Args, Return>) {
const RipookWrapper: React.FC<{
params: Args;
@pengx17
pengx17 / custom.css
Last active August 12, 2023 00:25
my theme for logseq.com
@import url('https://cdn.jsdelivr.net/gh/pengx17/logseq-theme@master/custom.css');
@pengx17
pengx17 / test.js
Created November 8, 2021 14:37
test.js
alert('hello world')