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 detail_s = "平时会有什么非常重要的事情,要这么严肃以公告的形式发布出来呢?我也不知到,但是估计下来这里也可以放下很多的字吧,万一不够还可以省略掉是不是。但是居然不能用sketch还得用上PS不过也就这样吧..." | |
var HeaderTitle = React.createClass({ | |
render: function () { | |
return ( | |
<span className="card-title-h1"> | |
{this.props.title} | |
</span> | |
); | |
} |
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 'babel-polyfill' | |
const rp = require('request-promise'); | |
var request = require('request'); | |
const fsp = require('fs-promise'); | |
const cheerio = require('cheerio'); | |
var iconv = require('iconv-lite'); | |
var firPage = 'http://online.ncu.edu.cn/eol/homepage/common/' | |
var loginPage = 'http://online.ncu.edu.cn/eol/homepage/common/login.jsp' |
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
/** | |
* 在指定的时间内,若函数被多次触发 | |
* 则只会调用最新的一次,避免不必要的性能开销 | |
* 调用时间: 最后一次触发 + 设定的等待时间 | |
* | |
* @param {Function} func 要延时的函数 | |
* @param {Number} wait 延迟时间/ms | |
* @return {Function} 延迟后的函数 | |
*/ | |
const debounce = (func, wait) => { |
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
// 1000内,只触发一次 | |
const throttle = (cb, time = 1000, ctx = null) => { | |
let timer = null | |
return (...args) => { | |
if (timer) { | |
return | |
} | |
timer = setTimeout(() => { | |
cb.apply(ctx, args) | |
timer = null |
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 sortWeek (schedules) { | |
schedules = schedules.map(s => sortDay(s)) | |
} | |
function sortDay (schedule) { | |
const sorted = [] | |
const hasSort = [] | |
let base = schedule[0] | |
for (let i = 0; i < schedule.length; i++) { | |
if (base === null) { |
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
interface IRoutes { | |
path: string, | |
content: string | |
} | |
class Router { | |
routes: Array<IRoutes> = [] | |
view: HTMLDivElement = null | |
register (route: IRoutes) :void { |
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
/** | |
* Sample React Native App | |
* https://github.com/facebook/react-native | |
* @flow | |
*/ | |
import React, { Component } from 'react'; | |
import { | |
AppRegistry, | |
StyleSheet, |
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
{ | |
"jest": { | |
"preset": "react-native", | |
"setupFiles": [ | |
"<rootDir>/jest-setup.js" | |
], | |
"transform": { | |
"^.+\\.js$": "<rootDir>/node_modules/babel-jest", | |
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js" | |
}, |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "es2015", | |
"module": "es2015", | |
"moduleResolution": "node", | |
"pretty": true, | |
"jsx": "react", | |
"outDir": "build", | |
"allowSyntheticDefaultImports": true, | |
"noImplicitAny": false, |
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
// XMLHttpRequest | |
var xhr = new XMLHttpRequest() | |
xhr.open('GET', 'https://httpbin.org/ip') | |
xhr.onload = function () { | |
console.log('responseText: ', xhr.responseText) | |
console.log('responseText type: ', typeof xhr.responseText) | |
console.log('JSONData: ', JSON.parse(xhr.responseText)) | |
console.log('JSON type:', typeof JSON.parse(xhr.responseText)) | |
} | |
xhr.send() |
OlderNewer