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 (exports) { | |
function urlsToAbsolute(nodeList) { | |
if (!nodeList.length) { | |
return []; | |
} | |
var attrName = 'href'; | |
if (nodeList[0].__proto__ === HTMLImageElement.prototype || nodeList[0].__proto__ === HTMLScriptElement.prototype) { | |
attrName = 'src'; | |
} | |
nodeList = [].map.call(nodeList, function (el, 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
#user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
#error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
#pid logs/nginx.pid; | |
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
// 引入puppeteer模块 | |
const puppeteer = require('puppeteer'); | |
// puppeteer内置的设备描述信息 | |
const devices = require('puppeteer/DeviceDescriptors'); | |
// 模拟iPhone 6 Plus | |
const iPhone6P = devices['iPhone 6 Plus']; | |
async function run() { | |
console.log('正在获取数据,请查看打开的浏览器窗口...'); | |
// 启动浏览器并设置窗口大小 |
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 fs = require('fs'); | |
const path = require('path'); | |
const http = require('http'); | |
var server = http.createServer((req, res) => { | |
const oldEnd = res.end; | |
let body = []; | |
let isString = 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
console.clear(); | |
function render(template, data){ | |
console.info('render ==>', template, data); | |
template = template.replace(/\{\{([#^])([^}]+?)\}\}(?:([\s\S]*?)\{\{\/(\2+?)\}\})?/g, function (match, ope, key, content, key1) { | |
if (key !== key1) { | |
throw Error(key + ' and ' + key1 + ' does not match.'); | |
} | |
var value = getValue(data, key); |
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 http = require('http'); | |
var options = { | |
// proxy server ip | |
hostname: '127.0.0.1', | |
// proxy server port | |
port: 5525, | |
// the request url (absolute path) | |
path: 'http://www.example.com/', | |
method: 'GET', | |
// should set Host header. or it will be `127.0.0.1:5525` |
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
/** | |
* @file step-flow example | |
* @author zdyng | |
*/ | |
'use strict'; | |
const fs = require('fs'); | |
const path = require('path'); | |
const md5 = require('md5'); |
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
/** | |
* @file ActionSheet API | |
* @author zdying | |
* @providesModule ActionSheet | |
*/ | |
import React, {Component} from 'react'; | |
import {Modal, Text, View, TouchableWithoutFeedback} from 'react-native'; | |
export default class ActionSheet extends Component { |
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
/** | |
* @file 控制台文本颜色 | |
* @author zdying | |
*/ | |
'use strict'; | |
(function(){ | |
var colorDisabled = process.argv.indexOf('--no-color') !== -1; |
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
void | |
function() { | |
'use strict'; | |
var http = require('http'), | |
url = require('url'), | |
net = require('net'); | |
function printError(err, msg, url) { | |
console.log('%s %s: %s', new Date().toLocaleTimeString(), msg, url, err); | |
} |
NewerOlder