Skip to content

Instantly share code, notes, and snippets.

View crimx's full-sized avatar

CRIMX crimx

View GitHub Profile
@crimx
crimx / Drag&Drop.cmd
Last active March 18, 2017 11:50
应急使用,合并两个中英 srt 字幕为上中下英双语,使用字幕组的 ass 样式。两个字幕在不同的 layer 所以允许保留各自的时间,不需要人工调整。先 npm install subtitles-parser
node %~dp0\index.js %*
@crimx
crimx / promise-more.js
Created July 28, 2017 05:05
Promise helper
/**
* Like Promise.all but is always successful.
* @param {Array|Object} iterable
* @returns {Promise} A promise with an array of all the resolved/rejected results. null for rejection.
*/
export const reflect = function reflect (iterable) {
if (!Array.isArray(iterable)) {
iterable = Array.from(iterable)
}
@crimx
crimx / countries.json
Last active February 28, 2018 18:12 — forked from jacobbubu/countries.json
Chinese country names and their ISO code
[
{
"ISO2": "AD",
"ISO3": "AND",
"DIGITS": "20",
"ISO-3166-2": "ISO 3166-2:AD",
"English": " Andorra",
"China": "安道尔",
"Taiwan": "安道爾",
"Hongkong": "安道爾",
@crimx
crimx / reactive.js
Last active April 5, 2018 07:57
Thoughts on reactive implementation
function compose (...funcs) {
if (funcs.length <= 0) {
return x => x
}
if (funcs.length === 1) {
return funcs[0]
}
const innerFunc = funcs[funcs.length - 1]
const restFunc = funcs.slice(0, -1)