Skip to content

Instantly share code, notes, and snippets.

@qfox
qfox / comb.js
Created June 30, 2016 21:30
comb.js
module.exports = function comb(matrix) {
return Object.keys(matrix).reduce((res, k) => _fillIn(res, k, matrix[k]), [{}]);
/**
* Adds all combinations of existing array and incoming variants
* @param {Array<Object>} combinations - existing combinations
* @param {String} key - new key for items in combinations
* @param {Array} values - values for new key
* @returns {Array<Object>} - modified
*/
@qfox
qfox / .eslintrc
Last active July 15, 2016 22:28
bundle-builder-prototype
parserOptions:
ecmaVersion: 6
sourceType: module
env:
node: true
es6: true
extends: pedant
@qfox
qfox / gulpfile.js
Last active September 30, 2016 02:57
const path = require('path');
const gulp = require('gulp');
const debug = require('gulp-debug');
const Builder = require('gulp-bem-bundle-builder');
const bundler = require('gulp-bem-bundler-fs');
const postcss = require('gulp-postcss');
const postcssUrl = require('postcss-url');
const autoprefixer = require('autoprefixer');
const csso = require('gulp-csso');
/node_modules
/.gitignore
/* $ for i in common.blocks/button2/_theme/button2_theme_*.css; echo $i:; head $i; echo '---'; end */
/* common.blocks/button2/_theme/button2_theme_action.css: */
.button2_theme_action {
position: relative;
z-index: 0;
color: #000;
border: none;
outline: none;
}
// Узел содержит значение с маской и связи. Формат узла:
{
scope: {block: ?String, elem: ?String},
block: ?String,
elems: ?Array<{
scope: {block: ?String, elem: ?String},
elem: ?String,
mods: ?Object<String, String[]>,
shouldDeps: ?Array,
mustDeps: ?Array
let REFLECTION_ID = 0;
const ReflectionFlag = {
Private: 1,
Protected: 2,
Public: 4,
Static: 8,
Exported: 16,
ExportAssignment: 32,
External: 64,
'use strict';
const filtr = require('filterable');
module.exports = toJSFunction;
function toJSFunction(conditions) {
const keys = [];
const includes = ($v, v) => typeof v === 'string' ?
$v.toLowerCase().indexOf(v.toLowerCase()) !== -1 :
v.some((_v) => $v.toLowerCase() === _v.toLowerCase());
@qfox
qfox / x.ts
Created February 6, 2018 16:10
interface NestedWalker {
protected ctx: { path: string, cell: BemEntityName };
protected naming: BemNamingEntity;
public isLeaf(path): boolean;
public isDir(path): boolean; ← should we go deeper?
};
/*
/lib ← level, library
@qfox
qfox / README.md
Created January 24, 2018 00:51
Import one git repo as a subdirectory to another (monorepo maker)

monorepish

How to use

cd git-monorepo
env PACKAGE_NAME=babel/babel-bridge node import | bash