Skip to content

Instantly share code, notes, and snippets.

View ArVan's full-sized avatar

Arpy Vanyan ArVan

  • Yerevan, Armenia
View GitHub Profile
@ArVan
ArVan / Form.css
Last active October 28, 2018 09:53
A React component with custom HTML5 validation error layouts
.was-validated .form-control:valid~.invalid-feedback {
display: none;
}
@ArVan
ArVan / Routes.js
Created January 15, 2018 16:34
A React HOC for loading router components upon request
import React, {Component} from 'react';
import {Route, Switch, Redirect, withRouter} from 'react-router-dom';
import HomePage from './containers/HomePage';
const AsyncUserPage = asyncComponent(() => {
return import('./containers/UserPage');
});
class Routes extends Component {
@ArVan
ArVan / app.js
Last active March 11, 2021 03:06
JWT Authentication with Passport
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var index = require('./routes/index');
var user = require('./routes/user');
var auth = require('./routes/auth');
@ArVan
ArVan / httpStatusText.js
Last active August 29, 2015 14:06
HTTP status code titles for Node.js
module.exports = HTTPStatusText = {
// INFORMATIONAL CODES
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
// SUCCESS CODES
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',