Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

React victorpavlenko

🎯
Focusing
Block or report user

Report or block victorpavlenko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@victorpavlenko
victorpavlenko / gist:6f5862cf430fa342d18594d8af4d1ae5
Created Jan 16, 2019
Замыкание в functional component
View gist:6f5862cf430fa342d18594d8af4d1ae5
Замыкание в 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>
View React
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: 'элемент',
View preloader.jsx
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
View Api auth
import {
express,
aws,
multer,
multerS3,
body
} from './modules';
import {
login,
View Query
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) => {
View Route
import {
express,
appConfig
} from './modules';
const root = express.Router();
/* GET home page. */
root.get('/onboard', function (req, res) {
View contact.js
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';
View Рубл
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 // рубля
View class.js
/** Вычисляем общую сумму **/
var setSumm = {
sum : function(dataObject){
var summary = [],
sum = 0;
for( var i = 0; i < Object.keys(dataObject).length - 1; i++){
summary.push(dataObject[i].summ)
}
View view.js
var createView = function(settings, type){
var template,
context;
if(type == 'documents'){
/** Рисуем шаблон документов **/
var documentFormat = [];
You can’t perform that action at this time.