Skip to content

Instantly share code, notes, and snippets.

View RafaPegorari's full-sized avatar

Rafael Pegorari RafaPegorari

View GitHub Profile
@RafaPegorari
RafaPegorari / example.js
Created July 29, 2019 12:44
Validate route parameters in middleware of express using Joi
// file: lib/middleware-joi-validator/index.js
const Joi = require('@hapi/joi');
const validate = (schema, options) => {
options = options || {}
const validateRequest = (req, res, next) => {
const toValidate = {}
if (!schema) {
/**
* GET /
*/
exports.index = function (req, res) {
jiraResponse(req.params.key);
res.render('story', {
//title: jiraResponse(req.params.key)
});
import React from 'react';
import { browserHistory, IndexRoute, Router, Route } from 'react-router';
import Layout from './views/layout';
import Home from './views/home';
import Doc from './views/doc';
const Routes = () => (
<Router history={browserHistory}>
<Route path='/' component={Layout}>
/**
* Color
*
* @author: Rafael Pegorari <rafapegorari@gmail.com>
* @copyright Copyright (c) 2015-2017, MEANStack.io.
* @license See LICENSE
* MIT Licensed
*/
'use strict';
/**
* Install Gulp in Global
* $ npm install gulp -g
*
* Install Gulp in local
* $ npm install gulp --save-dev
*
* Install dependecies Gulp
* $ npm install gulp-concat gulp-uglify gulp-sourcemaps --save-dev
*
@RafaPegorari
RafaPegorari / articleController.js
Last active August 1, 2016 23:33
Example controller MEANStack.io
'use strict';
var router = require('meanstack').Router(),
auth = require('modules/auth'),
Model = require('app/models/model');
/*
Method Route Action Return Description Resource AngularJS
GET /article index Html Articles index. ---
GET /article/load load Action Load articles. query({action: 'load'}... )
@RafaPegorari
RafaPegorari / SetGetParamUrl.js
Created November 20, 2015 12:13
Set and Get Param Url
var getParam = function (param) {
var url = window.location.search.substring(1),
params = url.split("&"),
val = '';
$.each(params, function (i, v) {
var pair = v.split("=");
if (pair[0] == param) {
val = pair[1];
}
});
@RafaPegorari
RafaPegorari / footer-fixed.js
Created November 10, 2015 14:16
Footer fixed.
@RafaPegorari
RafaPegorari / validate.js
Last active November 10, 2015 11:07
validate.js
$.validator.setDefaults({
debug: !0,
errorClass: "has-error",
highlight: function (a, b) {
$(a).closest("div").addClass(b);
},
unhighlight: function (a, b) {
$(a).closest("div").removeClass(b);
}
});
@RafaPegorari
RafaPegorari / has-error.css
Created November 10, 2015 11:06
has-error.css
.has-error {
position: relative;
}
.has-error label.has-error {
position: absolute;
top: 0 !important;
background-color: #FFB8B8;
right: 0 !important;
left: auto !important;