Skip to content

Instantly share code, notes, and snippets.

Type Description Required Keys Optional Keys
success All went well, and (usually) some data was returned. status, payload
fail There was a problem with the data submitted, or some pre-condition of the API call wasn't satisfied status, payload
error An error occurred in processing the request, i.e. an exception was thrown status, message code, payload
{
  "status": "success",
 "payload": {
@ezhlobo
ezhlobo / AbstractAction.js
Last active June 11, 2019 12:34
Organize actions in redux architecture
/* eslint-disable no-underscore-dangle */
const noop = () => {}
class ActionCreator {
constructor(type, payload = noop, args = []) {
this._type = type
this._payload = payload
this._args = args
@ezhlobo
ezhlobo / development.js
Created July 9, 2016 14:54
Debug funcitons
const isFormsProtectedByCSRF = () =>
document.querySelectorAll('form').length === document.querySelectorAll('input[name=_csrf]:not([disabled])').length
@ezhlobo
ezhlobo / filter__control-text.scss
Last active August 29, 2015 14:26
Code examples
@import 'merge';
.filter__control-text {
font-family: inherit;
font-size: 14px;
color: $color--text--gray;
text-decoration: none;
cursor: pointer;
@at-root button#{&} {
@ezhlobo
ezhlobo / .jscsrc
Last active August 29, 2015 14:20
Styleguides
{
"excludeFiles": ["node_modules/**", "dist/**"],
"disallowDanglingUnderscores": true,
"disallowEmptyBlocks": true,
"disallowFunctionDeclarations": true,
"disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],
"disallowKeywordsOnNewLine": ["else"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineBreaks": true,
"disallowMultipleSpaces": true,
@ezhlobo
ezhlobo / config.rb
Last active January 17, 2018 00:26
Config for middleman
require 'compass/import-once/activate'
require 'uglifier'
require 'csso'
require 'slim'
###
# Compass
###
# Change Compass configuration
@ezhlobo
ezhlobo / smartresize.js
Last active August 29, 2015 14:19
Debounced resize events
/*
smartresize(function() {
// Handle the resize event here
});
// Executing after loading
smartresize(function() {
// Handle the resize event here
})();
(function($) {
$.fn.outerHtml = function() {
return this[0].outerHTML;
};
})(jQuery);
@ezhlobo
ezhlobo / Preferences.sublime-settings
Last active August 29, 2015 14:13
Sublime Settings: User
{
"always_show_minimap_viewport": true,
"animation_enabled": false,
"bold_folder_labels": true,
"close_windows_when_empty": false,
"disable_tab_abbreviations_for_scopes": "source.css, source.scss",
"ensure_newline_at_eof_on_save": true,
"font_size": 12,
"hayaku_CSS_colors_case": "lowercase",
"hayaku_CSS_prefixes_disable": true,

Общее

  • Максимальная длина строки с правилами и селекторами - 80 символов.
  • Все свойства и селекторы на новой строке.

Описание свойства

Обычное свойство:

селектор {