Skip to content

Instantly share code, notes, and snippets.

View yangfan0095's full-sized avatar

fanyang yangfan0095

  • zhongan
  • shanghai
View GitHub Profile
@phobal
phobal / poll.js
Created May 2, 2018 02:49
closure - 2种实现
function getStatus() {
const random = Math.random() * 10
if (random > 5) {
return true
} else {
return false
}
}
function callback() {
@cnjimbo
cnjimbo / git中merge和rebase的区别.md
Last active February 24, 2021 07:37
git中merge和rebase的区别

最开始实习的时候是使用svn,之后正式工作就一直在使用git,这样算起来,使用git也有两年的时间了。以前带我的同事,让我在拉代码的时候要我使用git pull --rebase,一直很纳闷为什么要那样做,后来遇到拉代码的时候有许多冲突要解决,然后去查找资料,才了解到其中的一些事情。今天分享一下,顺便自己也梳理一下。

git pull

git pull 是 git fetch + git merge FETCH_HEAD 的缩写。所以,默认情况下,git pull就是先fetch,然后执行merge 操作,如果加–rebase 参数,就是使用git rebase 代替git merge。

merge 和 rebase

merge 是合并的意思,rebase是复位基底的意思。

//npm init -y
//npm install --save puppeteer
//usage: node script.js /path/to/input.html /path/to/output.pdf
//script.js
const puppeteer = require('puppeteer');
(async () => {
@tablatronix
tablatronix / configfragment.js
Last active June 17, 2017 15:09
getsimple ckeditor upload handler
// add to config.js editorconfig section. you can add ?path= query to this to use a subfolder
config.imageUploadUrl = "../admin/upload.php"
// add to config.js
CKEDITOR.on( 'instanceReady', function( ev ) {
// code for fileupload and response
ev.editor.on( 'fileUploadRequest', function( evt ) {
var fileLoader = evt.data.fileLoader,
formData = new FormData(),
xhr = fileLoader.xhr;
@dlutwuwei
dlutwuwei / express.md
Created May 20, 2014 01:30
express4.2源码解析

title: express4.2源码解析 date: 2014-05-18 15:00:50 categories: express tags: [nodejs, node, js, express]

express是nodejs平台上一个非常流行的框架,4.2.0是最新的版本,相比3.x版本优化了代码和api,去除了connect模块,自己实现了一个router组件,实现http请求的顺序流程处理,去除了很多绑定的中间件,使代码更清晰。

##1.使用express 如何使用express在官网有很好的讲解,只用experssjs实例app的几个函数,就可以构建构建web程序。