This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = { | |
activated: false, | |
resolve: () => {}, | |
}; | |
function useSignal() { | |
const [state, setState] = useState(initialState); | |
function init() { | |
return new Promise((resolve) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Optimize hybrid controlled component by add some method into proto | |
* | |
* Usage: | |
* @hybridCtrl | |
* class App extends React.Component { | |
* ... | |
* } | |
* | |
* @hybridCtrl('specified_prop_to_assign') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HistoryManager { | |
constructor(initialState) { | |
this.state = { ...initialState }; | |
this.history = [initialState]; | |
this.index = 0; | |
} | |
push(changes) { | |
this.state = Object.create(this.state, Object.getOwnPropertyDescriptors(changes)); | |
this.history.length = this.index + 1; // discard further redos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @date 2015/3/21 | |
* @author Dolphin | |
* | |
* Callback 风格的文件合并 | |
*/ | |
var fs = require('fs'); | |
function getFilesInDir(dir, cb) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 日本語文献サポート | |
\AtEveryBibitem{ | |
% langid={Japanese} で識別 | |
\iffieldequalstr{langid}{Japanese} { | |
% コンマで区切り | |
\DeclareDelimFormat{finalnamedelim}{% | |
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% | |
\addspace\multinamedelim | |
} | |
% 名前を「姓 名」の順に |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hookMap = new WeakMap(); | |
let currentContext = null; | |
let currentIndex = 0; | |
function load(component) { | |
if (!hookMap.has(component)) { | |
hookMap.set(component, []); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const magnitude = { | |
'十': 1e1, | |
'百': 1e2, | |
'千': 1e3, | |
'万': 1e4, | |
'亿': 1e8, | |
}; | |
const num = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ヒラギノ角ゴ */ | |
font-family: "ヒラギノ角ゴ Pro", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif; | |
/* ヒラギノ明朝 */ | |
font-family: "ヒラギノ明朝 Pro", "Hiragino Mincho Pro", "MS P明朝", "MS PMincho", serif; | |
/* From: 游明朝体・游ゴシック体のCSSでの利用 - Qiita [キータ] | |
* http://qiita.com/shinnn/items/5be7e8106189311559c1 | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Timeline based animation engine | |
* | |
* t | |
* ------+------------------------------------------> timeline | |
* +-----|-+ | |
* | A | | <- animation{} | |
* +-----|-+ | |
* +--|------+ | |
* | | A | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiew |
NewerOlder