Skip to content

Instantly share code, notes, and snippets.

@theexplay
theexplay / gist:f79ac1e303c6e33840bef07f6c0c357d
Last active November 18, 2019 12:48 — forked from realmyst/gist:1262561
Склонение числительных в javascript
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);
Массив легко создавать провяряя числа 1, 3 и 5.
Пример: decOfNum(5, ['секунда', 'секунды', 'секунд'])
import * as React from 'react';
import { storiesOf } from '@storybook/react';
import centered from '@storybook/addon-centered';
import { text, withKnobs } from '@storybook/addon-knobs';
import { AppBackButton } from './AppBackButton';
storiesOf('Nebula/Organism', module)
.addDecorator(withKnobs)
.addDecorator(centered)
.add('AppBackButton', () => {
@theexplay
theexplay / git_rebase.md
Created March 23, 2019 14:37 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

import React from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import Paper from '@material-ui/core/Paper'
import Button from '@material-ui/core/Button'
import Dialog from '@material-ui/core/Dialog'
import {withStyles} from '@material-ui/core/styles'
import Typography from '@material-ui/core/Typography'
import DialogTitle from '@material-ui/core/DialogTitle'
@theexplay
theexplay / prefixed-office-properties.md
Created June 9, 2017 10:19 — forked from p3t3r67x0/prefixed-office-properties.md
MS Office prefixed style properties can be used for older versions of MS Excel, MS PowerPoint or MS Word when you want to save a document, presentation, workbook, or worksheet as a web document, or even in older versions for MS Outlook.

MS Office prefixed style properties

mso-ansi-font-size

Note: Office only

mso-ansi-font-size: large | larger | <length> | medium | <percentage> | small | smaller | x-large | x-small | xx-large | xx-small
@theexplay
theexplay / districts.styl
Last active March 7, 2017 22:00
districts
@import '__'
$districts__cols = 3
$districts__width = _grid_value($grid__cols / $districts__cols)
$districts__offset = 15px
$districts__border-width = 1px
$districts__border-color = #e2e2e2 // @todo нет в константах
$districts__inner-offset = 24px
$districts__tablet__cols = 2
@theexplay
theexplay / mdToHtml.js
Last active October 25, 2016 15:12
md->html
var Vacancies = {
$tpl: elem.content,
$item_changed: 'changed',
$time: 800,
init: function () {
this.getData();
},
@theexplay
theexplay / SliderControls.js
Last active July 22, 2016 09:18
SliderControls.js
(function ($, window, document) {
var SliderControls = {
ui: {
$win: $(window),
$doc: $(document),
$controls: $('.views_slideshow_controls'),
$slidesWrapper: $('.views-slideshow-controls-bottom'),
$slide: $('.views_slideshow_thumbnailhover_div_breakout_teaser')
},
@theexplay
theexplay / apus.js
Created February 5, 2016 08:31
apus.js
(function ($, window, document, undefined) {
var Apus = {
meta: {
$doc: $(document),
$win: $(window),
url: window.location.pathname,
wHeight: 0,
wWidth: 0,
@theexplay
theexplay / grid.less
Created December 23, 2015 10:44
grid
/*
* Новая реализация.
* Новая сетка по высоте/ширине элементов.
*
* @param {object} params - включает в себя: шаг {number}, префикс {string}, css свойство {string}, !important {boolean}, debug {boolean}
* @param {number} itr - количество итераций
*/
.grid(@params, @itr) when (@itr > 0) {
@col: @itr;
@step: extract(@params, 1);