Skip to content

Instantly share code, notes, and snippets.

View ASnow's full-sized avatar

Большов Андрей ASnow

View GitHub Profile
@ASnow
ASnow / what-forces-layout.md
Created March 30, 2017 10:08 — 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()
/home/asnow/.rvm/gems/ruby-2.2.1@unp/gems/ruby-prof-0.15.2/lib/ruby-prof/printers/graph_html_printer.rb:62: [BUG] Segmentation fault at 0x00000000000000
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0049 p:---- s:0216 e:000215 CFUNC :to_s
c:0048 p:---- s:0214 e:000213 CFUNC :full_name
c:0047 p:0009 s:0211 e:000209 METHOD /home/asnow/.rvm/gems/ruby-2.2.1@unp/gems/ruby-prof-0.15.2/lib/ruby-prof/printers/graph_html_printer.rb:62
c:0046 p:0051 s:0205 e:000203 METHOD /home/asnow/.rvm/gems/ruby-2.2.1@unp/gems/ruby-prof-0.15.2/lib/ruby-prof/printers/graph_html_printer.rb:56
c:0045 p:0286 s:0196 e:000194 BLOCK (erb):149 [FINISH]
c:0044 p:---- s:0192 e:000191 CFUNC :each
0,10,20,30,40,50 * * * * /bin/bash -l -c 'cd /opt/capistrano/uniweb/releases/20160419162126 && rvmsudo -u www-data bundle exec rails runner -e production '\''CdnLoaderTask.run'\'' >> log/cron.log 2>> log/error.log'
0 8 * * * /bin/bash -l -c 'cd /opt/capistrano/uniweb/releases/20160419162126 && rvmsudo -u www-data bundle exec rails runner -e production '\''NoticeAboutExpiredGroupTask.run'\'' >> log/cron.log 2>> log/error.log'
## [message] Above is your schedule file converted to cron syntax; your crontab file was not updated.
## [message] Run `whenever --help' for more options.
@ASnow
ASnow / gist:79bb21f2a1435e2ff3e3
Last active March 31, 2016 09:38
Deploy env setup
# Deploy host
mkdir deploy
cd deploy
git clone git@github.com:uniwebru/uniweb-portal.git .
rvm use 2.2.1@deploy --create --rvmrc
git checkout feature/capistrano
bundle install --without test development app
# 1. prepare git for private
# https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
# https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
# https://help.github.com/articles/testing-your-ssh-connection/
# 2. deploy app
for file in config/samples/*.rb; do cp "$file" "${file/samples\//initializers\/}";done
for file in config/initializers/*.sample.rb; do mv "$file" "${file/.sample/}";done
for file in config/samples/*.yml; do cp "$file" "${file/samples\//}";done
for file in config/*.sample.yml; do mv "$file" "${file/.sample/}";done
bundle install
rvm install 1.9.3
rvm use 1.9.3@canvas --create
sudo apt-get install software-properties-common
rvm gemset use global
gem install bundler -v 1.5.1
gem uninstall bundler -v >1.5.1
bundle config build.nokogiri --use-system-libraries
sudo apt-get install libxml2 libxslt-dev libcurl4-gnutls-dev
# sudo apt-get install curl
bundle install --without mysql
@ASnow
ASnow / init_vps.sh
Last active February 12, 2016 09:12
./init_vps.sh username
# Ubuntu 14.04 initial script for rvm setup on VPS
# ./init_vps.sh username
sudo adduser $1
sudo usermod -aG sudo $1
sudo su $1
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
sudo apt-get install curl
\curl -sSL https://get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm install 2.2.4
@ASnow
ASnow / Gemfile
Last active August 29, 2015 14:24
Slim templating in Volt
# SEE https://github.com/ASnow/guard-volt-slim
Enable Shared Folders on vmware Fusion (4.x)+ (Example OS: Linux Ubuntu 12.x as guest OS)
1. First update your linux system:
sudo apt-get update
sudo apt-get install -y build-essential
sudo aptitude -y safe-upgrade
2. Reboot your system just in case you have a new kernel
sudo shutdown -r now