Skip to content

Instantly share code, notes, and snippets.

View foru17's full-sized avatar
🎯
Focusing

Luo Lei foru17

🎯
Focusing
View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active November 15, 2024 16:45
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
@hwdsl2
hwdsl2 / .MOVED.md
Last active October 15, 2024 03:15
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
@marcelosomers
marcelosomers / git-php-webhook.php
Last active October 17, 2024 17:17
A basic webhook for deploying updates to repos on Github to your local server
<?php
/**
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below).
*
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/
*
* INSTRUCTIONS:
* 1. Edit the variables below
* 2. Upload this script to your server somewhere it can be publicly accessed
@bomberstudios
bomberstudios / sketch-plugins.md
Last active February 26, 2024 07:02
A list of Sketch plugins hosted at GitHub, in no particular order.
@guo-yu
guo-yu / gist:6278806
Created August 20, 2013 08:39
js prototype 继承实例中的参数问题
var Book = function(name) {
this.name = name;
this.demo = '123';
}
var Method = function() {
// 继承了 Book 的静态属性 this.demo = '123'
Book.apply(this, arguments);
}
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active November 10, 2024 03:45
A badass list of frontend development resources I collected over time.
@benlumley
benlumley / Invoke
Last active December 17, 2015 20:19
Progress bar JS From http://www.newrepublic.com/
// The progress bar in article titles.
// Only do this on article pages.
if($('#page').hasClass('article')){
$('#title-progress-bar-container').tnrProgressBar({ maxWidthElement: $('#main') });
// The sticky header progress bar.
if($(window).width() == $('#fixed-header').width()){ // iPhone mode is full width.
$('#fixed-header-progress-bar-container').tnrProgressBar({
maxWidthOffset: -3,
maxWidthElement: $(window)
});