Skip to content

Instantly share code, notes, and snippets.

View pvolyntsev's full-sized avatar

Pavel Volyntsev pvolyntsev

View GitHub Profile
@paulirish
paulirish / what-forces-layout.md
Last active May 6, 2024 07:54
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
@pvolyntsev
pvolyntsev / LazyHttpSession.php
Last active September 15, 2015 06:35
Yii HTTP Sessions component with logic "Suppress PHP Session"
<?php
/**
* Class LazyHttpSession
* Обеспечивает подавление создания сессий PHP
*
* @author pavel.volyntsev@gmail.com
* @link http://copi.st/nMen
*/
class LazyHttpSession extends CCacheHttpSession // здесь надо указать супер-класс, используемый в твоём приложении
@joost
joost / icons8_client.rb
Created June 25, 2014 14:36
Super simple Ruby Icons8 API (http://api.icons8.com/) client
require 'hashie'
require 'faraday'
require 'faraday_middleware'
# Supersimple http://api.icons8.com/ client.
# Usage:
# Icons8Client.new.search('icon')
# See: https://gist.github.com/joost/e149404f645f33ba1939
class Icons8Client
def initialize(options = {})
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@willurd
willurd / web-servers.md
Last active May 6, 2024 13:43
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ivan1911
ivan1911 / declofnum.js
Last active June 5, 2016 12:45 — forked from realmyst/gist:1262561
Javascript склонение для числительных
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);