Skip to content

Instantly share code, notes, and snippets.

@WuXianglong
WuXianglong / dom_performance_reflow_repaint.md
Created August 27, 2021 02:47 — forked from faressoft/dom_performance_reflow_repaint.md
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@WuXianglong
WuXianglong / TextEncoderTextDecoder.js
Created July 9, 2020 04:03 — forked from Yaffle/TextEncoderTextDecoder.js
TextEncoder/TextDecoder polyfills for utf-8
// TextEncoder/TextDecoder polyfills for utf-8 - an implementation of TextEncoder/TextDecoder APIs
// Written in 2013 by Viktor Mukhachev <vic99999@yandex.ru>
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
// You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
// Some important notes about the polyfill below:
// Native TextEncoder/TextDecoder implementation is overwritten
// String.prototype.codePointAt polyfill not included, as well as String.fromCodePoint
// TextEncoder.prototype.encode returns a regular array instead of Uint8Array
// No options (fatal of the TextDecoder constructor and stream of the TextDecoder.prototype.decode method) are supported.
@WuXianglong
WuXianglong / Percentage_Circle2.html
Created October 24, 2019 08:04
Percentage Circle
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CSS Percentage Circle</title>
<style>
@import url("https://fonts.googleapis.com/css?family=Titillium+Web:200,200i,300,300i,400,400i,600,600i,700,700i,900");
body {
font-family: "Titillium Web", sans-serif;
margin: 0 auto;
}
@WuXianglong
WuXianglong / Percentage_Circle.html
Created October 23, 2019 06:32
Percentage Circle
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CSS Percentage Circle</title>
<style>
@import url("https://fonts.googleapis.com/css?family=Titillium+Web:200,200i,300,300i,400,400i,600,600i,700,700i,900");
body {
font-family: "Titillium Web", sans-serif;
margin: 0 auto;
}
@WuXianglong
WuXianglong / circle_bar.html
Last active October 23, 2019 06:32
Progress bar Circle using HTML5 and CSS3
<html>
<header>
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Lato:700);
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
@WuXianglong
WuXianglong / 爬虫
Created January 22, 2017 07:14
爬虫
# -*- coding: utf-8 -*-
import bs4
import requests
BASE_URL = 'http://bjcme.haoyisheng.com/beijing_project/listProjectGongbu.jsp'
CONTENT_URL = 'http://bjcme.haoyisheng.com/beijing_project/projectGongbuList.do?d-1342871-p=1&beian=&orderBy=subject&pici=&pageSize=10&parentSubjectId=&sdanwei=&type=&xmanager=&gongbu=3&gongbuCode=&subjectId=&name=&scode=&year=2017'
TEACHER_URL = 'http://bjcme.haoyisheng.com/beijing_project/projectTeacherList.do?requestType=PRINT&id=%s'
def get_content():
@WuXianglong
WuXianglong / android_pkg_name_validate.js
Created November 18, 2015 02:49
Regex to validate Android Package Name
var pattern = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+[0-9a-z_]$/i;
[
"me.unfollowers.droid",
"me_.unfollowers.droid",
"me._unfollowers.droid",
"me.unfo11llowers.droid",
"me11.unfollowers.droid",
"m11e.unfollowers.droid",
"1me.unfollowers.droid",
@WuXianglong
WuXianglong / .mongorc.js
Created May 22, 2015 09:40
个性化Mongo Client
print(" *** 努力实践mongodb,佛祖保佑!*** \n")
lis = new Array(
" _oo8oo_",
" o8888888o",
' 88" . "88',
' (| -_- |)',
' 0\\ = /0',
' ___/'==='\\___',
" .' \\\| |// '.",
" / \\\||| : |||// \\",
@WuXianglong
WuXianglong / gprof2dot.py
Last active December 18, 2017 04:11
Generate a dot graph from the output of several profilers.
#!/usr/bin/env python
#
# Copyright 2008-2014 Jose Fonseca
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@WuXianglong
WuXianglong / simDHT.py
Created December 1, 2014 03:52
simDHT
#!/usr/bin/env python
# encoding: utf-8
import socket
from hashlib import sha1
from random import randint
from struct import unpack
from socket import inet_ntoa
from threading import Timer, Thread
from time import sleep