Skip to content

Instantly share code, notes, and snippets.

View pafnuty's full-sized avatar
⚒️
No time for commit, just push!

Pavel Belousov pafnuty

⚒️
No time for commit, just push!
View GitHub Profile
@Big-Shark
Big-Shark / DecimalFraction.php
Last active August 29, 2015 14:22
Сложение десятичных дробей
<?php
class DecimalFraction
{
public $numerator;
public $denominator;
public $integer = 0;
public function __construct($numerator, $denominator, $integer = null)
{
if( is_null($integer) )
@xjamundx
xjamundx / blog-webpack-2.md
Last active April 21, 2024 16:20
From Require.js to Webpack - Part 2 (the how)

This is the follow up to a post I wrote recently called From Require.js to Webpack - Party 1 (the why) which was published in my personal blog.

In that post I talked about 3 main reasons for moving from require.js to webpack:

  1. Common JS support
  2. NPM support
  3. a healthy loader/plugin ecosystem.

Here I'll instead talk about some of the technical challenges that we faced during the migration. Despite the clear benefits in developer experience (DX) the setup was fairly difficult and I'd like to cover some of the challanges we faced to make the transition a bit easier.

@iAdramelk
iAdramelk / .md
Last active April 22, 2024 10:15
Длинная телега про Бутстрап

Английская версия: https://evilmartians.com/chronicles/bootstrap-an-intervention

Вводная часть

У CSS есть несколько базовых проблем, которые позволяют очень быстро отстрелить себе ногу при неправильном использовании:

  1. Глобальный неймспейс – в серверном программировании все что написано в файле, в файле и остается. Все же что написано в css и js засирает глобальное пространство имен со всеми вытекающими. В JS эту проблему сейчас побороли всякими модульными системами, а вот с css сложнее. В идеальном мире это должен починить Shadow DOM и настоящие Web Components, но пока их нет единственный способ с этим бороться – следовать какой-то системе именований селекторов, которая по возможности уменьшает и исключает возможные конфликты.

  2. Каскадность – если на один элемент может сработать несколько правил, то они все и сработают последовательно. Если есть элемент h1.title, на него сработают все правила для тегов h1 и все правила для класса .title. Так как весь html состоит из тегов, то правил которые п

<!-- HTML advanced commentary block -->
<snippet>
<content><![CDATA[
<${1:div} class="${2:col}">
${3:Content}
</${1:div}> <!-- .${2:col} -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>`hac</tabTrigger>
</snippet>

Работа с компонентом codenails:custom.form

В гисте план правильного создания формы и моменты, на которых спотыкаются незнакомые с компонентом разработчики

План-чеклист

  1. Продумываем список полей формы
  2. Создаем инфоблок для сохранения результатов и запоминаем коды свойств
  3. Создаем почтовое событие
  4. Создаем почтовый шаблон для события
  5. Настраиваем вызов компонента формы
  6. Настраиваем .config шаблона компонента формы
@xamedow
xamedow / .gitconfig
Last active October 22, 2015 11:19
local git configuration file
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = xamedow (Andrey Hamedov)
email = xamedow@gmail.com
[core]
editor = subl
[color "branch"]
current = yellow reverse
local = yellow
<!--
In Vue, we use v-model for all form bindings, while
Knockout maintains separate binding types, such as
textInput, checked, and options. In some cases,
such as for an input of type "range", Knockout
simply doesn't have an equivalent two-way binding
helper and the more verbose value and valueUpdate
must be used.
-->
<div id="app">
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;