This file contains hidden or 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 { createIntl,createIntlCache } = require('@yiminghe/no-react-intl'); | |
| const cache = createIntlCache() | |
| const intl = createIntl({ | |
| locale: 'en', | |
| messages: { | |
| hello:'hello {name}' | |
| } | |
| }, cache); |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>vba demo</title> | |
| <meta charset="UTF-8" /> | |
| </head> | |
| <body> | |
| <div> |
This file contains hidden or 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
| import * as regexp from "@yiminghe/regexp"; | |
| (async function () { | |
| const fakeData = ["x", "a", "b", "c", "a", "a", "b"]; | |
| let index = 0; | |
| let length = fakeData.length; | |
| let promise; | |
| let stream = []; | |
| // push data to steam | |
| setInterval(() => { | |
| stream.push(fakeData[index++ % length]); |
This file contains hidden or 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
| var RE2 = require("re2"); | |
| var re=new RE2('(a+a+)+y'); | |
| const str=''+('a'.repeat(20))+''; | |
| let start=Date.now(); | |
| console.log(!!str.match(re)); | |
| console.log(Date.now()-start); | |
| start=Date.now(); | |
| console.log(!!str.match(/(a+a+)+y/)); |
This file contains hidden or 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
| function callFn(f, ...args) { | |
| if (f.length === 0) { | |
| return f(); | |
| } | |
| if (f.length === args.length) { | |
| return f(...args); | |
| } | |
| if (f.length > args.length) { | |
| const ret = f.bind(null, ...args); | |
| ret.fn_name = `(${f.fn_name}(bind))`; |
This file contains hidden or 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
| var tmp = document.createElement('div'); | |
| document.body.appendChild(tmp); | |
| var React = require('react'); | |
| var Dialog = require('rc-dialog'); | |
| function alert(str){ | |
| var dialog = <Dialog title="alert" visible="true">{str}</Dialog>; | |
| React.render(dialog,tmp); | |
| } |
This file contains hidden or 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
| var XTemplate = require('xtemplate'); | |
| alert(new XTemplate('{{x}}').render({x:2})); |
This file contains hidden or 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
| var XTemplate = require('xtemplate'); | |
| alert(new XTemplate('{{x}}').render({x:2})); |
This file contains hidden or 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
| var d = Q.defer(), | |
| ret = [], | |
| p = d.promise; | |
| var p2 = p.then( | |
| function (v) { | |
| ret.push("e1 :" + v); | |
| throw "e1"; | |
| }, | |
| function (r) { |
This file contains hidden or 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
| var path = require("path"), | |
| fs = require("fs"); | |
| var jsdom = require("jsdom").jsdom; | |
| document = jsdom("<html><head></head><body></body></html>"); | |
| window = document.createWindow(); | |
| location = window.location; | |
| navigator = window.navigator; | |
| window.document = document; |