Skip to content

Instantly share code, notes, and snippets.

View polesye's full-sized avatar

Anton Stupak polesye

  • Zhytomyr, Ukraine
View GitHub Profile
@polesye
polesye / analytics-utils.js
Last active November 27, 2025 09:20
WIX analytics
// Filename: public/analytics/utils.js
// Code written in public files is shared by your site's
// Backend, page code, and site code environments.
// Use public files to hold utility functions that can
// be called from multiple locations in your site's code.
import wixLocationFrontend from "wix-location-frontend";
import { session } from "wix-storage-frontend";
@polesye
polesye / what-forces-layout.md
Created September 24, 2015 06:06 — 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()
#user nobody;
#Defines which Linux system user will own and run the Nginx server
worker_processes 1;
#Referes to single threaded process. Generally set to be equal to the number of CPUs or cores.
#error_log logs/error.log; #error_log logs/error.log notice;
#Specifies the file where server logs.
@polesye
polesye / abstract_factory.py
Last active July 14, 2020 20:56
AbstractFactory
import abc
import urllib2
from BeautifulSoup import BeautifulStoneSoup
class AbstractFactory(object):
"""Abstract factory interface provides 3 methods to implement in its
subclasses: create_protocol, create_port and create_parser."""
__metaclass__ = abc.ABCMeta
class Srt(AbstractClass):
MIME_TYPE = 'application/x-subrip'
@staticmethod
def get(contestore, location, filename):
name = Srt.get_filename(filename)
@staticmethod
def add(contestore, location, filename):
name = Srt.get_filename(filename)
@polesye
polesye / Notifier.js
Last active February 18, 2016 09:35
Example of observer pattern.
window.Notifier = (function(){
"use strict"
var Subscribe = {
subscribers : {},
set : function(id, callback){
if (!this.has(id)){
this.subscribers[id] = [];
}
this.subscribers[id].push(callback);