# 配置 remote 指向上游仓库
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
# 从上游获取
git fetch upstream
# 切回去自己的分支
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 insertScript(path) { | |
var script = document.createElement('script') | |
script.src = chrome.extension.getURL(path) | |
document.body.appendChild(script) | |
} | |
// insert patch sdk | |
insertScript('patch.js') | |
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
# encoding=utf8 | |
import MySQLdb | |
import sys | |
import time | |
reload(sys) | |
sys.setdefaultencoding('utf8') | |
specialSign = "<!--markdown-->" |
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 page = require('webpage').create(); | |
var url = 'http://ukn.me/#!/post/2016-07-13-Array%2520%25E9%259B%2586%25E5%2590%2588%25E6%2596%25B9%25E6%25B3%2595.md'; | |
// 视窗大小 | |
page.viewportSize = { | |
width: 1440, | |
height: 900 | |
} |
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
/** | |
* 获取一个数字的小数部分,如果是整数则返回 0 | |
*/ | |
function getDecimal(num: number): number { | |
// 原理是先将数字乘以一定倍速,作为整数来计算 | |
// 具体乘多大视乎小数点后有多少位 (10为基数的 x 次幂) | |
const BASE = Math.pow(10, (num.toString().split('.')[1] || '').length); | |
return num * BASE % BASE / BASE; | |
} |
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
// 比如 API 暴露 | |
function useApi () { | |
const a = 'a' | |
const b = 'b' | |
const c = 'c' | |
return Object.assign([ a, b, c ], { a, b, c }) // 务必数组在前,否则无法维护下标 | |
} | |
// 使用时既可以 | |
const [ a, b, c ] = useApi() // react hook 风格的数组解构 |
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 el = document.createElement('link') | |
el.rel = 'stylesheet' | |
el.href = 'main.css' | |
document.head.appendChild(el) | |
// 单条写法 | |
document.head.appendChild(Object.assign( | |
document.createElement('link'), | |
{ rel: 'stylesheet', href: 'main.css' }, |
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
{ | |
"createdBy": "Redirector v3.1.0", | |
"createdAt": "2018-05-30T05:26:18.152Z", | |
"redirects": [ | |
{ | |
"description": "cdnjs.cloudflare.com", | |
"exampleUrl": "https://cdnjs.cloudflare.com/foo", | |
"exampleResult": "https://cdnjs.loli.net/foo", | |
"error": null, | |
"includePattern": "*//cdnjs.cloudflare.com/*", |
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
// 坤坤写的自动版 | |
if (!Object.prototype.watch) { | |
Object.defineProperty(Object.prototype, "watch", { | |
enumerable: false, | |
configurable: true, | |
writable: false, | |
value: function (prop, handler) { | |
var oldval = this[prop], | |
newval = oldval, |
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
/*! | |
* 简单的"回到顶端"按钮,javascript封装版 | |
* wenhao(viko16) - v0.0.2 (2013-12-14 14:00:31+0800) | |
* Released under MIT license | |
* 需要先引入jquery框架 | |
*/ | |
$(document).ready(function() { | |
//在body结束前添加按钮 | |
$('body').append('<a href="#" class="back-to-top">回到顶端</a>'); |
NewerOlder