Skip to content

Instantly share code, notes, and snippets.

View fritx's full-sized avatar
🐢
slow but safe..

Fritz Lin fritx

🐢
slow but safe..
View GitHub Profile

2.6 Internal Change: Reverting nextTick to Always Use Microtask

The Original Problem

When Vue detects data mutation, it asynchronously defer DOM updates to the next "tick" so that multiple mutations trigger only one update cycle. In versions before 2.5, Vue has been deferring updates using what is known as the "Microtask" (as explained in this blog post).

This works fine in most situations, but we discovered an edge case:

  1. Given two nested elements, "outer" and "inner";
  2. "inner" has a click event handler which triggers an update
@pgilad
pgilad / Instructions.md
Last active March 27, 2024 12:59
Generate SSL Certificate for use with Webpack Dev Server (OSX)

Generate private key

$ openssl genrsa -out private.key 4096

Generate a Certificate Signing Request

openssl req -new -sha256 \
@FMCorz
FMCorz / store.js
Last active August 4, 2022 10:01
Fallback on cache when Axios reports a network error
import Axios from 'axios';
import { setupCache } from 'axios-cache-adapter';
import exclude from 'axios-cache-adapter/src/exclude';
// Define the cache adapter.
const cacheAdapter = setupCache({
clearOnStale: false,
});
const getKey = cacheAdapter.config.key;
@qzm
qzm / mvvm.html
Last active June 14, 2019 10:15
mvvm 框架的实现
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>MVVM</title>
<script src="mvvm.js"></script>
</head>
@zhanzengyu
zhanzengyu / google扩展程序
Last active February 3, 2017 06:11
google有用的一些扩展程序,让你的逼格更高,姿势更帅
1. Momentum:新建tab桌面壁纸效果
2. Isometric Contributions:让你在github上的commit记录以三维立体的方式进行展示。
3. Avatars for Github:让你github主页上的动态不只显示用户id,还显示用户头像。一目了然。
4. Octotree:让你浏览github上的开源项目时可以直接在Chrome侧边栏像打开文件夹一样查看别人的项目。一目了然。
5. Transit:google浏览器划词翻译,遇到不懂的可以划一下,提高英语水平。
mongo:
image: mongo:3.2.11
volumes:
- /data/db/mongo
ports:
- "27017:27017"
redis:
image: redis
volumes:
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

@cevaris
cevaris / struct_as_map_key.go
Last active October 20, 2023 03:18
Golang: Using structs as key for Maps
package main
import "fmt"
type A struct {
a, b int
}
func MapStructValAsKey(){
// Notice: We are using value of `A`, not `*A`
@Gaubee
Gaubee / node_alipay.js
Created June 22, 2014 08:19
nodejs·支付宝·即时到帐接口
/* *
*类名:AlipayConfig
*功能:基础配置类
*详细:设置帐户有关信息及返回路径
*版本:3.2
*日期:2011-03-17
*说明:
*以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*该代码仅供学习和研究支付宝接口使用,只是提供一个参考。
@markgoodyear
markgoodyear / 01-gulpfile.js
Last active May 5, 2023 03:21
Comparison between gulp and Grunt. See http://markgoodyear.com/2014/01/getting-started-with-gulp/ for a write-up.
/*!
* gulp
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),