Skip to content

Instantly share code, notes, and snippets.

View victorpavlenko's full-sized avatar
🎯
Focusing

React victorpavlenko

🎯
Focusing
View GitHub Profile
@victorpavlenko
victorpavlenko / gist:6f5862cf430fa342d18594d8af4d1ae5
Created January 16, 2019 12:26
Замыкание в functional component
Замыкание в functional component
function CustomForm ({handleSubmit}) {
let inputElement
return (
<form onSubmit={() => handleSubmit(inputElement.value)}>
<input
type='text'
ref={(input) => inputElement = input} />
<button type='submit'>Submit</button>
const data = [
{ id: 2, name: 'элемент', count: 0},
{ id: 1, name: 'элемент', count: 0},
{ id: 0, name: 'элемент', count: 0}
]
const appendItem = () => {
data.unshift({
id: data.length,
name: 'элемент',
import {
express,
appConfig
} from './modules';
const root = express.Router();
/* GET home page. */
root.get('/onboard', function (req, res) {
import {
seraph,
boltDriver,
to
} from '../modules';
export function getCreatedBy({uuid}) {
var cypher = 'MATCH (n {uuid: {uuid}})-[r:CREATED_BY]->(m)'
+ 'RETURN m';
return new Promise((resolve, reject) => {
import {
express,
aws,
multer,
multerS3,
body
} from './modules';
import {
login,
import React, {Component} from 'react';
import {reduxForm, addArrayValue} from 'redux-form';
import Switch from './switch';
import Scroll from './../atoms/scroll';
import PureInput from '../atoms/pure-input';
import PureDeepInput from '../atoms/pure-deep-input';
import PureSelect from '../atoms/pure-select';
import Location from '../atoms/location';
import validate from './validate-deep';
import {dispatchSaveOrgContact} from '../../lib/edit-org';
var React = require('react'),
scripts = require('./js/jsonld/scripts');
//var Main = require('./main');
var Preloader = React.createClass({
//
propTypes: {
data: React.PropTypes.array.isRequired,
new: React.PropTypes.object.isRequired
@victorpavlenko
victorpavlenko / Рубл
Created June 19, 2015 08:26
ь, я, ей
var forms = 'рубль,рубля,рублей'.split(',')
/* Алгориииитм! */
function getForm(x) {
var x10 = x % 10, x100 = x % 100, form = 2 // рублей
if (x10 == 1 && x100 != 11)
form = 0 // рубль
else if (x10 > 1 && x10 < 5 && (x100 < 10 || x100 > 21))
form = 1 // рубля
var settingJson = '../settings.json';
var settings = [];
var dataObject = {};
var phpUrl = 'upload.php';
$(function () {
@victorpavlenko
victorpavlenko / view.js
Last active August 29, 2015 14:20
view
var createView = function(settings, type){
var template,
context;
if(type == 'documents'){
/** Рисуем шаблон документов **/
var documentFormat = [];