Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yuanyuanlife's full-sized avatar

Yuan Yuan yuanyuanlife

View GitHub Profile
@demux
demux / parseApache2clickheat.py
Created February 17, 2011 13:17
A python script to convert apache logs into clickheat data logs.
#! /usr/bin/python
import os
import re
in_log_path = '/var/log/apache2/clickheat/'
out_log_path = '/var/www/clickheat/logs/'
site_files = []
@wintercn
wintercn / gist:5342839
Created April 9, 2013 03:55
取两个HTML节点最近的公共父节点
function getCommonParent(el1,el2){
var parents1 = [];
var el = el1;
while(el) {
parents1.unshift(el);
el = el.parentNode;
}
var parents2 = [];
@wintercn
wintercn / showboxes.js
Created May 21, 2013 06:34
显示页面的盒结构
function randomColor(){
return "rgb("+Math.floor(Math.random()*255)+","+Math.floor(Math.random()*255)+","+Math.floor(Math.random()*255)+")";
}
function showBoxes(window) {
var rects = [];
function getRects(node){
var range = window.document.createRange();
range.setStartBefore(node);
range.setEndAfter(node);
[
{
name:"HTML5",
uri:"http://www.w3.org/TR/html5/single-page.html",
category:"markup"
},
{
name:"HTML 5.1",
uri:"http://www.w3.org/TR/html51/single-page.html",
category:"markup"
@wintercn
wintercn / gist:6666747
Created September 23, 2013 05:28
Web API里可以new的东西
//Chrome上能用的
["Image", "Audio", "MediaController", "TrackEvent", "Option", "PopStateEvent", "HashChangeEvent", "PageTransitionEvent", "Event", "CustomEvent", "MutationObserver", "Document", "FormData", "XMLHttpRequest", "FormData", "IDBVersionChangeEvent", "StorageEvent", "RTCSessionDescription", "RTCIceCandidate", "MediaStreamEvent", "Notification", "Blob", "FileReader", "ErrorEvent", "Worker", "SharedWorker", "TransitionEvent"]
//标准里有但是还不能用的
["RelatedEvent", "DragEvent", "AnonXMLHttpRequest", "RTCPeerConnection", "RTCPeerConnectionIceEvent", "DataChannelEvent", "ClipboardEvent", "FileReaderSync", "BlobBuilder", "FileSaver", "ParGroup", "SeqGroup", "Animation", "PseudoElementReference", "KeyframeAnimationEffect", "PathAnimationEffect", "TimingEvent", "AnimationEvent"]
@paulirish
paulirish / what-forces-layout.md
Last active April 23, 2024 11:02
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Animated, //使用Animated组件
Easing, //引入Easing渐变函数
} from 'react-native';
@otakustay
otakustay / .eslintrc.json
Last active December 14, 2019 18:43
eslintrc
{
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"babel",