Skip to content

Instantly share code, notes, and snippets.

View awinogradov's full-sized avatar
:octocat:
Coding happiness

Tony Vi awinogradov

:octocat:
Coding happiness
View GitHub Profile
{
"plugins": [
["bem-import", {
"levels": [
"./common.blocks",
"./desktop.blocks"
],
"techs": ["js", "css"]
}]
]
import {decl} from 'bem-react-core';
import ddsl from 'ddsl-react';
const bemhtml = ddsl(function() {
block('omg')(
tag()('span'),
attrs()({ href : '//yandex.ru' })
);
});
@awinogradov
awinogradov / index.js
Last active August 17, 2016 19:25
Embedded React
'use strict';
// ------------------------------------------
// RUNTIME
const DDSL = require('./lib/ddsl');
const React = require('react');
const ReactDOM = require('react-dom/server');
const runtime = new DDSL({
@awinogradov
awinogradov / button.react.js
Last active August 17, 2016 08:12
react-flex
const block = require('react-flex/block');
module.exports = block('button')(
tag() => 'button',
attrs() => ({
name: this.ctx.name,
id: this.ctx.id
}),
onClick(e) => {
console.log('shit!');
  • дерево слоев
    • скролится на любое количество
  • редактор кода прототипа
    • загрузка кода
    • подсветка
    • автокомплит
    • хоткей
  • превью
    • загрузка обвязкой кода в айфрейм
  • обновление кода внутри айфрейма
@awinogradov
awinogradov / component.yml
Last active August 11, 2016 00:11
Component config
---
stability: locked
# базовые поля блока
bemjson:
text: "Кнопка"
id: "the-id"
name: "the-name"
# состояния компонента
'use strict';
const path = require('path');
module.exports = {
entry: './index.js',
module: {
loaders: [
{
test: /\.js$/,
@awinogradov
awinogradov / fetch.js
Created June 21, 2016 09:15
friendly-fetch
'use strict';
const ifetch = require('isomorphic-fetch');
ifetch.Promise = require('bluebird');
module.exports = function fetch(req) {
const url = `http://${window.location.hostname}:${window.location.port}${req.path}`;
return ifetch(url, {
method: req.method || 'POST',
body: JSON.stringify(req.body)
@awinogradov
awinogradov / dyn-example.js
Created May 15, 2016 21:28
Protein Dynamics ease example
const goods = [
{ title: 'Мопед', color: '#05668D' },
{ title: 'Велик', color: '#028090' },
{ title: 'Тачила', color: '#00A896' },
{ title: 'Водокачка', color: '#02C39A' },
{ title: 'Платье', color: '#F0F3BD' },
{ title: 'Штора', color: '#AEF6C7' },
{ title: 'Люстра', color: '#5B8266' },
{ title: 'Пес', color: '#294936' }
];
@awinogradov
awinogradov / index.js
Created March 19, 2016 15:32
Remove one csv from another and generate new csv
const fs = require('fs');
const parse = require('csv-parse');
const all = fs.readFileSync('./all.csv');
const confirm = fs.readFileSync('./confirm.csv');
parse(all, {}, (err, allMembers) => {
parse(confirm, {}, (err, confirmedMembers) => {
const confirmedMembersEmails = {};
confirmedMembers.forEach(member => {