Skip to content

Instantly share code, notes, and snippets.

View gsasouza's full-sized avatar
🔥
Working on bleeding edge

Gabriel Souza gsasouza

🔥
Working on bleeding edge
View GitHub Profile
const findKeyInFlattenObject = (labelKey) => ([key]) => key.endsWith(labelKey);
const getHeaderLabel = (obj) => {
const flattenObject = dot.dot(obj);
const [_, value] = Object.entries(flattenObject).find(findKeyInFlattenObject('name'));
return value;
}
const headerLabels = headerArray.map(getHeaderLabel('name'));
import * as React from 'react'
import MUIOutlinedInput from '@material-ui/core/OutlinedInput';
import FormControl from '@material-ui/core/FormControl';
import styled, { css } from 'styled-components';
import { connect, FormikContext, getIn } from 'formik'
import FormHelperText from '@material-ui/core/FormHelperText';
import MaskedInput from 'react-text-mask'
import InputAdornment from '@material-ui/core/InputAdornment';
import Visibility from '@material-ui/icons/Visibility';
import VisibilityOff from '@material-ui/icons/VisibilityOff';
@gsasouza
gsasouza / Arthur.jsx
Last active August 30, 2019 22:07
Arthur exemplo
import React from 'react'
class Filho extends React.Component {
render() {
return (
<div onClick={this.props.updatePai}>
FILHO
</div>
)
#include <stdio.h>
#include <math.h>
void swap (double* a, double* b) {
double aux = *b;
*b = *a;
*a = aux;
}
int main(){
const findOnePedido = async (clienteId) => {
try {
var pedidoFind = await Pedido.findOne({clienteId}).lean();
if(pedidoFind) {
return false
}
return true
} catch (error) {
return false
}
const findOnePedido = async (clienteId) => {
try {
var pedidoFind = await Pedido.findOne({clienteId}).lean();
if(pedidoFind) {
return false
}
return true
} catch (error) {
return false
}
struct LinkedListNode {
int dest;
struct LinkedListNode* next;
};
struct LinkedList {
unsigned int label;
bool has_reached;
struct LinkedListNode *node;
};
var uploadFile = function(req, res){
var responseMessages = new serverResponse(),
clientId = req.params.clientId,
form = new formidable.IncomingForm();
form.keepExtensions = true;
form.uploadDir = path.join(__dirname, '../balanceSheets/tmp');
form.on('file', function(field, file) {
//console.log(file, field)
@gsasouza
gsasouza / roles.js
Created December 18, 2018 02:53
Medium - Roles
export default = [
'ADMIN',
'RESOURCE_A',
'RESOURCE_B',
'RESOURCE_A:CREATE',
'RESOURCE_A:READ',
'RESOURCE_B:CREATE',
'RESOURCE_B:READ',
]
@gsasouza
gsasouza / UserModel.ts
Last active December 18, 2018 02:46
RBAC - UserModel
const schema = new mongoose.Schema(
{
// other schema props
roles: {
type: [String],
default: [],
required: true,
},
}
);