Skip to content

Instantly share code, notes, and snippets.

Avatar
😇
I may be slow to respond.

ahuigo ahuigo

😇
I may be slow to respond.
View GitHub Profile
@ahuigo
ahuigo / asynchronous.js
Created Dec 12, 2020 — forked from simonrelet/asynchronous.js
React hooks for asynchronous calls
View asynchronous.js
import React from 'react'
/**
* @typedef {object} State The state of asynchronous hooks.
* @property {object | null} error The error.
* @property {boolean} pending Whether the call is pending.
* @property {any | null} result The result of the asynchronous call.
*/
/** @type {State} */
@ahuigo
ahuigo / asynchronous.js
Created Dec 12, 2020 — forked from simonrelet/asynchronous.js
React hooks for asynchronous calls
View asynchronous.js
import React from 'react'
/**
* @typedef {object} State The state of asynchronous hooks.
* @property {object | null} error The error.
* @property {boolean} pending Whether the call is pending.
* @property {any | null} result The result of the asynchronous call.
*/
/** @type {State} */
@ahuigo
ahuigo / ssh-proxy-setup
Created Mar 11, 2019
setup proxy for ssh connection
View ssh-proxy-setup
# 添加到 ~/.ssh/config
# 修改 <custom-name> 为任意名字
# 修改 <ip> 为服务器地址
# 修改 <username> 为登录服务器的用户名
# 修改 <port> 为服务器端口
# 修改完 ssh custom-name 就可以登录服务器了
# 下面的配置是仅 Mac 有效的
Host <custom-name>
User <username>
HostName <ip>
View vue-slot.html
<div id="parent-template">
<h1>我才是boss</h1>
<child>
<p>>原始头</p>
<p slot="head">我是头</p>
<p slot="foot">我是尾</p>
<p slot="xx">我没用</p>
<p>>原始尾</p>
</child>
</div>
@ahuigo
ahuigo / jsfiddle.html
Last active Aug 27, 2018
Simple codepen fiddle
View jsfiddle.html
data:text/html,<body oninput="i.srcdoc=h.value+'<style>'+c.value+'</style><script>'+j.value+'</script>'"><style>textarea,iframe{width:100%;height:50%}body{margin:0}textarea{width:33.33%;font-size:18}</style><textarea placeholder=HTML id=h></textarea><textarea placeholder=CSS id=c></textarea><textarea placeholder=JS id=j></textarea><iframe id=i>