Alipay | |
---|---|
![]() |
![]() |

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 expr = `(a.name == 'lsong' ? b : { c:2 }) + 30`; | |
const data = { | |
a: { | |
name: 'lsong' | |
}, | |
b: 1, | |
}; | |
const getValue = (expr, data) => { |
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 beijing = { | |
social_fund: { | |
min: 2820, | |
max: 14096, | |
// rate: .105 | |
rate: { | |
medical: .02, | |
endowment: .08, | |
unemployment: .005 |
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 quicksort = arr => { | |
if(arr.length <= 1) return arr; | |
const pivotIndex = arr.length / 2; | |
const pivot = arr.splice(pivotIndex, 1)[0]; | |
const left = []; | |
const right = []; | |
for(var i = 0; i < arr.length; i++){ | |
if(arr[i] < pivot){ | |
left.push(arr[i]); |
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
'use strict'; | |
const PENDING = Symbol(); | |
const FULFILLED = Symbol(); | |
const REJECTED = Symbol(); | |
function Promise(fn) { | |
if (typeof fn != 'function') { | |
throw new Error('resolver should be a function!'); | |
} |
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 tasks = [ | |
1,1,1,1,,1,1,1,1 | |
,1,1,1,2,2,2,2,3, | |
3,,3,43,4343,43, | |
,43,4,3,4,34,3,4,3 | |
] | |
.filter(Boolean) | |
.map(t => cb => { | |
setTimeout(cb, 1000, 1,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
import React from 'react'; | |
class LineChart extends React.Component { | |
render() { | |
const lines = []; | |
const { data } = this.props; | |
data.reduce((y, y2, x) => { | |
lines.push({ x, y, y2 }); | |
return y2; | |
}, 0); |
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
/** | |
* super tiny testing framework | |
* | |
* @author Liu song <[email protected]> | |
* @github https://github.com/song940 | |
*/ | |
function color(str, c){ | |
return "\x1b[" + c + "m" + str + "\x1b[0m"; | |
}; |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<playlist xmlns="http://xspf.org/ns/0/" xmlns:vlc="http://www.videolan.org/vlc/playlist/ns/0/" version="1"> | |
<title>Playlist</title> | |
<trackList> | |
<track> | |
<location>http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8</location> | |
<title>CCTV1 HD</title> | |
<extension application="http://www.videolan.org/vlc/playlist/0"> | |
<vlc:id>0</vlc:id> | |
<vlc:option>network-caching=1000</vlc:option> |