Skip to content

Instantly share code, notes, and snippets.

@cnlon
cnlon / install-vim-from-sources-ubuntu.sh
Last active December 11, 2019 02:40 — forked from shaypal5/install-vim-from-sources-ubuntu.sh
Installing Vim 8 on Ubuntu 16.04 LTS
# 1. Remove old vim 7
sudo apt remove vim vim-runtime gvim
sudo apt remove vim-tiny vim-common vim-gui-common vim-nox
sudo apt autoremove
# 2. Install dependencies
sudo apt install libncurses5-dev libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev libbonoboui2-dev \
libcairo2-dev libx11-dev libxpm-dev libxt-dev python-dev \
python3-dev ruby-dev lua5.1 lua5.1-dev libperl-dev git
@cnlon
cnlon / what-forces-layout.md
Created January 7, 2019 03:27 — forked from paulirish/what-forces-layout.md
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.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@cnlon
cnlon / elvis.js
Created September 21, 2017 08:55 — forked from cdmckay/elvis.js
A simple "elvis" operator in JavaScript
function elvis(object, path) {
return path ? path.split('.').reduce(function (value, key) {
return value && value[key];
}, object) : object;
}
// Example
var o = { a: { b: 1, c: 2 }, d: 3 };
elvis(o, 'a');
// = { b: 1, c: 2 }
@cnlon
cnlon / easing.js
Created March 1, 2017 03:08 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity