Skip to content

Instantly share code, notes, and snippets.

View SanichKotikov's full-sized avatar
🤔
Working...

Sanich SanichKotikov

🤔
Working...
View GitHub Profile
@SanichKotikov
SanichKotikov / what-forces-layout.md
Last active September 22, 2015 07:40 — 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()
@SanichKotikov
SanichKotikov / hyphenate.css
Created September 29, 2015 08:12
Long words & hyphenate in CSS
/* https://justmarkup.com/log/2015/07/31/dealing-with-long-words-in-css/ */
.hyphenate {
overflow-wrap: break-word;
word-wrap: break-word;
-webkit-hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
@SanichKotikov
SanichKotikov / git-user-stats.rb
Created October 1, 2015 12:56
Get git user stats
#!/usr/bin/env ruby
# author: someone from the Internet
impact = Hash.new(0)
IO.popen("git log --pretty=format:\"%an\" --shortstat #{ARGV.join(' ')}") do |f|
prev_line = ''
while line = f.gets
changes = /(\d+) insertions.*(\d+) deletions/.match(line)

Подробная книга на русском языке: Git Book

Перечислю основные "рабочие" команды. За детальными объяснениями и полным списком команд, обращаться к книге.

Настройки

Пользователь

function isIOS() {
return !!navigator.platform.match(/iPhone|iPod|iPad/);
}

Send emails from localhost (Mac OS X, Postfix)

Step 1. Edit Postfix config file

Open a terminal and edit the file main.cf

sudo vi /etc/postfix/main.cf

Find all recently modified files (OS X)

find ~/Documents -type f -ctime -0 | more
  • find ~/Documents: Runs the Unix find command, starting in the Documents folder, and then reading all other directories at or below that level. To start find in the current directory, you would use find ., and then the rest as shown above.
  • -type f: Finds only files, not directories, symbolic links, or other special Unix file types.
  • -ctime -0: Limits the modification time to the latest 24-hour period (rounded).
  • | more: This just sends the output to the Unix paging system, so you can read it one screen at a time.
const doc = document.body || document.documentElement;
const style = doc.style;
if ( style.webkitFlexWrap == '' || style.msFlexWrap == '' || style.flexWrap == '' ) {
doc.className += " supports-flex";
}
#!/bin/bash
# My example bash script
file="./icon.png"
iosNames=( icon-60 icon-60@2x icon-60@3x icon-76 icon-76@2x icon-40 icon-40@2x icon icon@2x icon-72 icon-72@2x icon-small icon-small@2x icon-50 icon-50@2x )
iosSizes=( 60 120 180 76 152 40 80 57 114 72 144 29 58 50 100 )
androidNames=( ldpi mdpi hdpi xhdpi xxhdpi xxxhdpi )
androidSizes=( 36 48 72 96 144 192 )

Настройка XAMPP под Mac OSX

XAMPP — кроссплатформенная сборка веб-сервера, содержащая Apache, MySQL, интерпретатор скриптов PHP, язык программирования Perl и большое количество дополнительных библиотек, позволяющих запустить полноценный веб-сервер.

С установкой самого XAMPP проблем возникнуть не должно, а вот на настройку нужно потратить немного времени. Итак, что бы завести свой вируальный хост, необходимо сделать следующее:

Включить VirtualHosts

Сначала нужно открыть файл /Applications/XAMPP/xamppfiles/etc/httpd.conf в любом текстовом редакторе, и найти следующие строки: