This file contains 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
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj | |
Cloning into 'my-awesome-proj'... | |
ssh: connect to host github.com port 22: Connection timed out | |
fatal: Could not read from remote repository. | |
$ # This should also timeout | |
$ ssh -T git@github.com | |
ssh: connect to host github.com port 22: Connection timed out | |
$ # but this might work |
This file contains 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 rad(d: number): number { | |
return (d * Math.PI) / 180; | |
} | |
function getDistanceByLatLng(lat1, lng1, lat2, lng2): number { | |
const EARTH_RADIUS = 6378137; | |
const r1 = rad(lat1); | |
const r2 = rad(lat2); | |
const a = r1 - r2; | |
const b = rad(lng1) - rad(lng2); |
This file contains 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 noop = function(){}; | |
var errorHandler = { | |
callback: null, | |
init: function (callback) { | |
errorHandler.callback = callback || noop; | |
window.onerror = errorHandler.script; | |
window.addEventListener('error', errorHandler.source, true); | |
window.addEventListener('unhandledrejection', errorHandler.promise, true); |
This file contains 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: yabingzyb.zhang | |
* @Date: 2018-10-16 15:45:13 | |
* @Last Modified by: yabingzyb.zhang | |
* @Last Modified time: 2018-10-16 17:43:12 | |
*/ | |
import React, { Component, PropTypes } from 'react'; | |
import { View, Dimensions } from 'react-native'; |
This file contains 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 urlQuery = { | |
getAll(url) { | |
if(!url) { | |
return {}; | |
} | |
const regx = /([^?=&]+)=([^&]*)?/g, | |
result = {}; | |
url.replace(regx, (_, $1, $2) => result[$1] = decodeURIComponent($2 || '')); |
This file contains 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 urlQuery = { | |
getAll(url) { | |
if(!url) { | |
return {}; | |
} | |
const regx = /([^?=&]+)=([^&]*)?/g, | |
result = {}; | |
url.replace(regx, (_, $1, $2) => result[$1] = decodeURIComponent($2 || '')); |
This file contains 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
## Sublime Text 3 Serial key build is 3176 | |
> * Added these lines into /etc/hosts | |
127.0.0.1 www.sublimetext.com | |
127.0.0.1 license.sublimehq.com | |
> * Used the license key | |
----- BEGIN LICENSE ----- |
This file contains 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 {string} str - 替换目标 | |
* @param {object} replacer - 替换值集合 | |
* @param {string} prefix - 替换字符左边界 | |
* @param {string} suffix - 替换字符右边界 | |
*/ | |
const templateReplacer = ( | |
str = '', | |
replacer = {}, |
This file contains 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
export const weekUtils = { | |
ONE_DAY: 86400000, | |
defaultWeekDays: [1, 2, 3, 4, 5, 6, 7], | |
/** | |
* 根据周开始星期重排周次顺序 | |
* @params startDay | |
*/ | |
sortWeekDays(startDay = 1) { | |
// 存在并且无法转为int类型时返回默认周次 | |
if (startDay && isNaN(parseInt(startDay))) { |
This file contains 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 microLink 应用宝微下载链接 | |
* @param schemeUrl 需要打开的schemeUrl | |
* @param downloadUrl App通用下载地址 | |
*/ | |
function openOrDownloadApp(microLink, schemeUrl, downloadUrl) { | |
// 收集设备信息 | |
var deviceInfo = { | |
userAgent: navigator.userAgent.toLowerCase(), | |
isAndroid: !!navigator.userAgent.match(/android/ig), |
NewerOlder